Kaffe.Consumer.handle_message
You're seeing just the function
handle_message
, go back to Kaffe.Consumer module for more information.
Call the message handler with the restructured Kafka message.
Kafka messages come from brod as an Erlang record. To make processing simpler for clients we convert that to an Elixir map. Since the consumer can subscribe to multiple topics with multiple partitions we also add the topic and partition as additional fields.
After compiling the Kafka message your message handler module's
handle_message
function will be called.
If async
is false:
- Your message handler module's
handle_message/1
function will be called with the message - The Consumer will block and wait for your
handle_message
function to complete and then automatically acknowledge the message as processed.
If async
is true:
- Your message handler module's
handle_message/2
function will be called with the pid of the running Consumer process and the message. - Message intake on the Consumer will not wait for your
handle_message/2
to complete and will not automatically acknowledge the message as processed. - Once you've processed the message you will need to call
Kaffe.Consumer.ack/2
with the pid and message.