CONSUME LATEST MESSAGE FROM KAFKA TOPIC IN MULE 4.X
Kafka Connector In Mule?Kafka connector helps you to interact with Apache Kafka Messaging system and provide seamless integration between mule application and apache messaging system Operation available.
Kafka uses zookeeper so you first need to start the ZooKeeper Server, zookeeper is packaged with kafka
Run the below?command?to start zookeeper
Step 3:
.\bin\windows\kafka-server-start.bat .\config\server.properties
Command to create the topic
kafka-topics.bat –create –bootstrap-server localhost:9092 –replication-factor 1 –partitions 1 –topic test
you can verify if the topic has created successfully in kafka instance using below command
kafka-topics.bat –list –bootstrap-server localhost:9092
CONSUME LATEST MESSAGE FROM KAFKA TOPIC IN MULE 4.X
Drag and drop kafka publish operation from mule palette
Configure the producer connection details and the bootstrap server Url
Currently I have kept all the default values as is and Producer?Acknowledge Mode=ALL
Configure the Kafka Message Listener to consume the message from the topic
Convert binary Data to JSON and write the payload to file using write file connector.
?test to consume the latest message only