Created
May 9, 2021 23:50
-
-
Save aspett/8fbae44aa77ffffdab9965cf66521a3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule BroadwayPipeline do | |
use Broadway | |
def start_link(_opts) do | |
Broadway.start_link(__MODULE__, | |
name: BroadwayPipeline, | |
producer: [ | |
module: {Producer, []}, | |
concurrency: 1, | |
], | |
processors: [ | |
default: [concurrency: 1] | |
] | |
) | |
end | |
@impl true | |
def handle_message(processor, message, context) do | |
IO.inspect("Processing #{inspect(message)}") | |
# Call the database, call some APIs, etc | |
message | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment