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

consume message from Kafka Topic

 

Provide the bootstrap url and topic name fromwhere you want to consume the message

consume message from Kafka Topic

 

Configure the below parameters as required, I have set Auto Offset Value as Earliest to fetch all message from topic which was published eariler

consume message from Kafka Topic

 

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 taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Harish
Harish
4 years ago

thank you for valuable information. I just want to connect to external kafka server. How can I do that?

swat
swat
1 year ago

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.