Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edragonconnect/off_broadway_mns
A Aliyun MNS producer for Broadway.
https://github.com/edragonconnect/off_broadway_mns
Last synced: about 6 hours ago
JSON representation
A Aliyun MNS producer for Broadway.
- Host: GitHub
- URL: https://github.com/edragonconnect/off_broadway_mns
- Owner: edragonconnect
- License: apache-2.0
- Created: 2020-07-17T08:15:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-29T02:22:50.000Z (8 months ago)
- Last Synced: 2024-10-05T02:39:17.220Z (about 1 month ago)
- Language: Elixir
- Size: 43 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OffBroadwayMNS
**A Aliyun MNS connector for Broadway**
## Installation
The package can be installed by adding `off_broadway_mns` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:off_broadway_mns, "~> 1.0"}
]
end
```Documentation can be found at .
## Usage
```elixir
defmodule XXX.Pipeline.MNS do
use Broadway
require Logger
alias Broadway.Messagedef start_link(queue) do
Broadway.start_link(
__MODULE__,
name: __MODULE__,
producer: [
module: {
OffBroadway.MNS.Producer,
queue: queue
},
concurrency: 4
],
processors: [
default: [
concurrency: 4,
min_demand: 16,
max_demand: 32
]
],
batchers: [
default: [
concurrency: 2,
batch_size: 200,
batch_timeout: 3000
]
]
)
end@impl true
def handle_message(_, message, _) do
Message.update_data(message, fn data ->
# update data here
data
end)
end@impl true
def handle_batch(_, messages, _batch_info, _context) do
Enum.map(messages, fn
message ->
# add handle code here
# if failed return: Message.failed(message, "failed reason")
message
end)
end@impl true
def handle_failed(messages, _context) do
# add handle code here
messages
end
end
```