Example: Introduction
Explore how to implement asynchronous microservice communication using Kafka. Understand producer and consumer roles, data models in JSON format, and domain-driven design patterns for effective event-driven integration between invoicing, shipping, and ordering microservices.
We'll cover the following...
Introduction #
The example in this section is based on the example for events from Events (see the drawing below).
The microservice microservice-kafka-order is responsible for creating the order as it sends the orders to a Kafka topic. Therefore, the microservice-kafka-order is the producer.
Two microservices read the orders; the microservice microservice-kafka-invoicing issues an invoice for an order, and the microservice microservice-kafka-shipping delivers the ordered goods.
The two microservices are organized in two consumer groups. Each record is just consumed and processed by:
- one instance of the microservice microservice-kafka-invoicing
- one