Skip to content

Instantly share code, notes, and snippets.

@softberries
Created March 21, 2023 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softberries/3cfad20ecd8bc5f2888ea757a63200ac to your computer and use it in GitHub Desktop.
Save softberries/3cfad20ecd8bc5f2888ea757a63200ac to your computer and use it in GitHub Desktop.
def handle_failed(messages, _context) do
IO.puts("Messages in failed stage: #{inspect(messages)}")
Enum.map(messages, fn %{status: {:failed, "invalid-data"}} = message ->
IO.puts("ACK invalid message and log error: #{inspect(message.data)}")
Broadway.Message.configure_ack(message, on_failure: :ack)
message -> message
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment