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 them to be read in the same input sequence.

As we can see depicted in the next image (ref : Kaka producer image) representing the distribution of messages coming from applications in a topic, the applications can be produce events that are distributed in one to n partitions of a topic, and that subsequently can be consumed by one to n consumers

Start kafka from command line

As we commented in the previous article if we start from a kafka distribution, installed for example in a linux distribution inside Windows 10 WSL2, whose reference you can have here, and If you have never configured Kafka on Windows 10, we will discuss it in the following article, first of this series

Tech, IT architecture & software development

Passionate and curious about technology. IT Architect and engineer