Knowledge Hub

An Introduction to Event Driven Architecture

NEED HELP

Looking for something?

An Introduction to Event Driven Architecture

Manish Pathak and Rohit Kukreti, Cloud Practice, PEA Proficiency, December 13, 2018

Event Driven Architecture (EDA) is a software architecture pattern for facilitating communication or integration between disparate software systems or components. It consists of atomic decoupled components responsible for asynchronous event processing. This EDA design helps in building highly scalable and distributed systems.

There are a few terms to be kept in mind before we move further:

  • Event: It is a signal emitted by component or application every time there’s a change in the system. It is an independent unit of message, and consists of adequate information for event processors to continue work. This decouples the event producers from event processors

  • Event Producer & Event Processors: These are the components that generate and react to events respectively

There are two ways to implement an Event Driven Architecture:

  1. Pub / sub: In this model, the messaging infrastructure keeps track of all the subscriptions. When an event is published, the messaging infrastructure re-sends the event to each event processor (also called a subscriber). After an event is received, it cannot be replayed and new subscribers don’t see the event.

  2. Event streaming: In the event streaming model, events are written to a log or a store. Events are strictly ordered (within a partition) and are durable. Event processors (also called clients) don't subscribe to the stream; instead a client can read from any part of the stream. The client handles advancing its position in the stream which allows them to join at any time, and replay events.

Event processing is further categorized as:

  1. Simple Event Processing: The client processes the event immediately after receiving an event. It is used for real-time or near real-time workflows and can help reduce lag time.

  2. Complex Event Processing: The client processes a series of events and based on the results it performs respective activities. E.g., Consumers read data from wireless health monitoring system for a certain period and generates notifications if the aggregated values cross the threshold.

  3. Event Streaming Processing: In event streaming processing, data streaming platforms like Azure IoT Hub or Apache Kafka is used to ingest events. Different stream processors read and process the event stream for any transformation activities.

Advantages of EDA

  1. Scalability: Enables highly scalable distributed systems as producers and processors are independent of each other.

  2. Flexibility: Helps create a flexible system as the components / services are loosely coupled making it easier to add new or modify an existing component / service.

  3. High Performance: As broadcasters do not wait for the processors to process the messages, the system tends to be much more performant.

Disadvantages of EDA

  1. High Maintenance: As the system grows and there are additional events and processors added to the system, the maintenance overhead tends to increase.

  2. Constant Updates: Evolving and changing event schema requires changes to all the processors.

  3. Consistency: Maintaining consistency of data state across multiple processors is non-trivial.

EDA in Cloud

Recently, public cloud vendors have started providing services like Queues, Topics, etc. This has made to make seamless integration between various components. Technologies like serverless architecture, micro services, stream analytics, etc. enables the designing of complex scenarios and services like IoT Hub, Event Hub or Apache Kafka on the cloud. This  have made makes it possible to perform event processing for heavy work load feasible along with several types of transformation for multiple sub-systems.

EDA in Healthcare (typical uses cases) 

  1. Integrating different systems like enrollment, billing, etc. can be accomplished using EDA. In such case, data entry in one system raises an event for other systems to process and perform actions.

  2. Personal Health Monitoring systems like remote patient monitoring systems are well suited for Event Driven Architecture. Devices can stream patient’s health data to services like Azure IoT hub or Apache Kafka and the recipient processing services can process the data as required.

Case Study: An Event Driven Communication Platform

The client is a leading provider of Dialysis Services. They wanted to build a communication platform to provide curated content to individual physicians; automate the existing legacy manual compliance processes; and provide an application for important physician resources.

Figure 1 - System Schematic

CitiusTech partnered with the client to develop the system using a polygot approach. The components were developed in languages such as Java, node.js, Python, etc., and the pub / sub model of EDA was used to establish communication between these components. Each component published an appropriate set of events / messages to the service bus queue where it’s read and processed by the consumer components. Many services behave as a publisher and a subscriber, both. This enabled different development teams to enhance individual components / modules using development languages / tools of their choice. With EDA, these components / modules could communicate with each other effortlessly. By using this approach, the client was able to quickly develop new features and enhanced its applications to meet new business requirements, without the need to rewrite existing modules.
 
Conclusion
 
Today interconnectivity has become a core architectural need. EDA enables different independent systems / components to connect easily without large investments. EDA is a good fit for systems where:
 
  • Low latency and near real time responsive times are crucial

  • 2 phase commit or processing order / sequence is important

  • Traditional batch processing or data collection methodologies need to be replaced.

  • EDA in conjunction with request driven or synchronous systems can create a highly scalable, consistent and always available system