handle_failed, go back to Broadway module for more information.
Invoked for failed messages (if defined).
messagesis the list of messages that failed. If a message is failed in
handle_message/3, this will be a list with a single message in it. If some messages are failed in
handle_batch/4, this will be the list of failed messages.
contextis the user-defined data structure passed to
This callback must return the same messages given to it, possibly updated.
For example, you could update the message data or use
in a centralized place to configure how to ack the message based on the failure
This callback is optional. If present, it's called before the messages are acknowledged according to the producer. This gives you a chance to do something with the message before it's acknowledged, such as storing it in an external persistence layer or similar.
This callback is also invoked if
crash or raise an error. If this callback crashes or raises an error,
the messages are failed internally by Broadway to avoid crashing the process.