Even driven Architecture — Series Part II — Sending and consuming Messages from CLI with Kafka

Introduction and basic concepts

Photo by Maxim Ilyahov on Unsplash

EDA, even driven Architecture with Kafka, has two main qualities, which is to decouple the producer and the consumer, as we will show with the use of some examples, and to give a persistent messaging system in its most basic form.

It also greatly improves the scalability, and the release of resources of the systems involved in any software solution.

There are several basic concepts we should know from Kafka, before to start with the practice:

An event is a record that something has happened in your solution. An event can be composed of a key, a message and a timestamp.

Producers are the applications that produce events

Consumers are the applications that read and consume these events.

Events are organized in topics and can have multi-producers and multi-consumers, with persistence as one of their main characteristics. Topics can be replicated.

Topics are partitioned, allowing the distribution of information in several Kafka Brokers, which ensures the scalability of the system. In addition, events with the same key are recorded in the same partition, allowing…