Broadway.prepare_messages
You're seeing just the callback
prepare_messages
, go back to Broadway module for more information.
Specs
prepare_messages(messages :: [Broadway.Message.t()], context :: term()) :: [ Broadway.Message.t() ]
Invoked for preparing messages before handling (if defined).
It expects:
message
is theBroadway.Message
struct to be processed.context
is the user defined data structure passed tostart_link/2
.
This is the place to prepare and preload any information that will be used
by handle_message/3
. For example, if you need to query the database,
instead of doing it once per message, you can do it on this callback.
The length of the list of messages received by this callback is based on
the min_demand
/max_demand
configuration in the processor. This callback
must always return all messages it receives, as handle_message/3
is still
called individually for each message afterwards.