Event Driven Architecture

Event Driven Architecture

Microservice is an architectural design pattern that comprise of an application as a collection of small, loosely coupled services that operate together to achieve a common goal. Because they work independently, they can be added, removed, or maintained without interfering with other modules of the application.

Event-driven microservices allow for real-time micro services communication, it enables data to be consumed in the form of events before they’re even requested, they act in response to an event.

By implementing Event Driven Microservices architecture styles, developers can easily achieve non-functional qualities such as performance, availability, scalability, resiliency and rapid development.

Event-driven architecture is the new jargon, TechTarget defines it as a  “framework that orchestrates behavior around the production, detection, and consumption of events and the responses they evoke. An event is any identifiable occurrence that has significance for system hardware or software.”

Components of Event Driven Architecture

Event Backbone

The event backbone is mainly responsible for transmission, routing, and serialization of events. It can also provide APIs for processing event streams.

Event generator

Basically the source of event from where it has been generated it could be a user action or an external trigger; it is the first logical layer which senses an action and represents that action as an event message.

Event channel

This is another layer where events get propagated from even generator generally it is a TCP/IP connection or a middleware like Active MQ, Rabbit MQ etc. once message received in the channel a event listener get called to perform action based on it. Event channels provide to process messages/events asynchronously. The events are stored in a queue, waiting to be processed later by the event processing layer.

Event Processing

This is final layer which perform certain processing in the system and either send response to the event generator or it can trigger another event through event chaining.

Example of Event Driven services

An e-commerce application which implements event based services would work as follows:

  1. The CheckOut Service creates an Order in a pending state and publishes an OrderCreated event.
  2. The Payment Service receives the event and attempts to reserve credit for that Order. It then publishes either a Credit Card Process event or a CreditCardError event.
  3. The CheckOut Service receives the event from the Payment Service and changes the state of the order to either successful or failed.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code