Kafka is a popular distributed message queue with a lot of advanced functions for building distributed systems. This recipe will show how to write to a Kafka topic using a synchronous producer, and how to consume the same topic using a partition consumer. This recipe will not explore different configurations of Kafka, as that is a much wider topic beyond the scope of this book, but I suggest beginning at https://kafka.apache.org/intro.
Getting ready
Configure your environment according to these steps:
- Refer to theTechnical requirementssection at the beginning ofthis chapter.
- Install Kafka using the steps mentioned athttps://www.tutorialspoint.com/apache_kafka/apache_kafka_installation_steps.htm.
- Alternatively, you can also accesshttps://github.com/spotify/docker-kafka.
How to do it...
These steps cover writing and running your application:
- From your Terminal...