Using Apache Kafka for messaging
In this section, we are going to introduce you to Apache Kafka, a popular message broker system that we are going to use to establish asynchronous communication between our microservices. You will learn the basics of Kafka, how to publish messages to it, and how to consume such messages from the microservices we created in the previous chapters.
Apache Kafka basics
Apache Kafka is an open source message broker system that provides the ability to publish and subscribe to messages containing arbitrary data. Originally developed at LinkedIn, Kafka has become perhaps the most popular open source message broker software and is used by thousands of companies around the world.
In the Kafka model, a component that publishes messages is called a producer. Messages are published sequentially to objects called topics. Each message in a topic has a unique numerical offset in it. Kafka provides APIs for consuming messages (the component for consuming...