Skip to content

Instantly share code, notes, and snippets.

@aspett
Created May 9, 2021 23:50
Show Gist options
  • Save aspett/8fbae44aa77ffffdab9965cf66521a3b to your computer and use it in GitHub Desktop.
Save aspett/8fbae44aa77ffffdab9965cf66521a3b to your computer and use it in GitHub Desktop.
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