Broadway.handle_batch
You're seeing just the callback
handle_batch
, go back to Broadway module for more information.
Specs
handle_batch( batcher :: atom(), messages :: [Broadway.Message.t()], batch_info :: Broadway.BatchInfo.t(), context :: term() ) :: [Broadway.Message.t()]
Invoked to handle generated batches.
It expects:
batcher
is the key that defined the batcher. This value can be set in thehandle_message/3
callback usingBroadway.Message.put_batcher/2
.messages
is the list ofBroadway.Message
structs in the incoming batch.batch_info
is aBroadway.BatchInfo
struct containing extra information about the incoming batch.context
is the user defined data structure passed tostart_link/2
.
It must return an updated list of messages. All messages received must be returned, otherwise an error will be logged. All messages after this step will be acknowledged according to their status.
In case of errors in this callback, the error will be logged and the whole batch will be failed. This callback also traps exits, so failures due to broken links between processes do not automatically cascade.
For more information on batching, see the "Batching" section in the Broadway
documentation.