Message Listener
Let’s see how we can consume message from Kafka Topic using Kafka connector
Create project in Anypoint studio
Drag and drop message listener operation from mule palette
Configure the connector
Provide the bootstrap url and topic name fromwhere you want to consume the message
Configure the below parameters as required, I have set Auto Offset Value as Earliest to fetch all message from topic which was published eariler
Offset: The offset is a simple integer number that is used by Kafka to maintain the current position of a consumer. That’s it. The current offset is a pointer to the last record that Kafka has already sent to a consumer in the most recent poll. So, the consumer doesn’t get the same record twice because of the current offset.
Please set Earliest if you want to re-read all the message from the beginning, if you want to get the last message set the Latest Offset which is by default
Deploy and test the application, all the messages are displayed in the logs
thank you for valuable information. I just want to connect to external kafka server. How can I do that?
Change the bootstrap server information with external Kafka server e.g. instead of localhost:9092 put external kafka ipaddress and port
The post was very useful. I have a query regarding delivery count on kafka listener. I can see we can set the redelivery policy but where we can get the delivery count i dont see any attributes that can give us this info.
Thanks in Advance.