Sitemap

Event Driven Architecture

2 min readMay 3, 2023
Photo by Jason Leung on Unsplash

What exactly is event driven architecture?

It is a software architecture pattern that uses events as the mode of communication between services.

In other words, the services or components in Event Driven Architecture does not communicate using CQRS, but using Events.

It has three main components.

  1. Producer
  2. Channel
  3. Consumer

Producer

This is the component of service sending the event. We can call it has publisher too. It is basically reporting that the component done completed.

e.g created/ updated/ deleted record

The producer will push the event to the Channel.

Channel

This is for me the most important component in the Event Driven Architecture. Channel is responsible for distributing the events to the relevant parties. Basically Channel places the event in a specialized queue (we may call it the Topic). Then consumers listen to this queue.

e.g Kafka, RabbitMQ etc..

Each Channel has its pros and cons.

Each Channels may use different methods to distribute the events such as Queue, REST API Call.

Consumer

The consumer is the component that receive the event (sent by the producer) and distributed by the channel. In other words, consumer receives and processes the event.

Normally consumers get the event using either:

  1. Push — channel push the event to consumer.
  2. Pull — consumer pulls from the channel.

This method depends on the channel used.

Advantages of Event Driven Architecture

  1. This is asynchronous by nature. The channel does not necessarily wait for the response from consumer. Thus performance will be better.
  2. There is no coupling between producer and consumer. In-fact producer (or channel) does not know who are consumers.
  3. Scalability aspect is better as we can have as much consumers are possible and producer does not care.

--

--

Ishan Liyanage
Ishan Liyanage

Written by Ishan Liyanage

Passionate Technical Lead, Senior Software Developer and free and open source software advocate. Based in Singapore.

No responses yet