Broadway v0.1.0 Broadway.Acknowledger behaviour View Source

A behaviour used to acknowledge that the received messages were successfully processed or failed.

When implementing a new connector for Broadway, you should implement this behaviour and consider how the technology you're working with handles message acknowledgement.

The c:ack/2 callback must be implemented in order to notify the origin of the data that a message can be safely removed after been successfully processed and published. In case of failed messages or messages without acknowledgement, depending on the technology chosen, the messages can be either moved back in the queue or, alternatively, moved to a dead-letter queue.

Link to this section Summary

Functions

Acknowledges successful and failed messages grouped by {acknowledger, ack_ref}

Callbacks

Invoked to acknowledge successful and failed messages

Link to this section Functions

Link to this function

ack_messages(successful, failed) View Source
ack_messages([Broadway.Message.t()], [Broadway.Message.t()]) :: no_return()

Acknowledges successful and failed messages grouped by {acknowledger, ack_ref}.

Link to this section Callbacks

Link to this callback

ack(ack_ref, successful, failed) View Source
ack(
  ack_ref :: reference(),
  successful :: [Broadway.Message.t()],
  failed :: [Broadway.Message.t()]
) :: :ok

Invoked to acknowledge successful and failed messages.

  • ack_ref is a term that uniquely identifies how messages should be grouped and sent for acknowledgement. Imagine you have a scenario where messages are coming from different producers. Broadway will use this information to correctly identify the acknowledger and pass it among with the messages so you can properly communicate with the source of the data for acknowledgement.

  • successful is the list of messages that were successfully processed and published.

  • failed is the list of messages that, for some reason, could not be processed or published.