Introduction to Event Driven Architecture (EDA)

An event driven architecture consists of event procedures that generate a stream of events and event consumers that listen for the events. 

The event driven architecture helps manage this by building a central unit that accepts all data and then delegates it to separate modules that handle the particular type of data. This handoff is said to generate an ‘event’ and it is delegated to the code assigned to that type. 

There are few terms to be kept in mind.

  • Event – It’s a signal emitted by component or application every time there is a change in system
  • Event Procedure and Event Processors – These are the components that generate and react to events respectively

There are 2 ways to implement event-driven architecture:

  • Pub / Sub
  • Event Streaming

EDA – Advantages & Disadvantages

Advantages
  • Scalability – Enables highly scalable distributed systems as procedures and processors are independent of each other.
  • Flexibility – Helps create a flexible system as the components/services are loosely coupled making it easier to add new or modify an existing service.
  • High Performance – As broadcasters do not wait for the processors to process the messages, the system tends to be much more performant.
Disadvantages
  • High Maintenance – As the system grows and additional events and processors become a part of the system, the maintenance overhead tend to increase.
  • Constant Updates – Evolving and changing event schema requires changes to all the processors.
  • Consistency – Millions of events run concurrently leading to some overlapping which causes consistency issues.

EDA – On prem or on Cloud

Technologies like serverless architecture, microservices etc enable designing of complex scenarios and services like Azure Event Hub or Apache Kafka on cloud or on prem.

Case Study: EDA in Insurance 

  • Integrating different systems like crop search, village search, drawing polygon, policy purchase and initiating claims can be accomplished using EDA. Here data entry in one system creates an event for other systems to process and perform actions.
  • Crop Health Monitoring systems like remote geo crop sensing monitoring systems are suited for EDA. App can stream crop health data to services like Azure Event Hub or Apache Kafka and the recipient processing services can process the data as required.
Situation

Our Kshema app is among the leading crop insurance applications. We wanted to build a claims platform to provide hassle-free claims initiating process to farmers, we wanted to automate the existing legacy manual claims process and provide an application for farmers to initiate seamless claims process.

  • Our internal team consists of developers, QA, product including marketing and growth team to develop the system using a polygot approach.
  • The components are planning to develop in Java, NodeJS, Python and the Pub / Sub model of EDA will be used to establish the communication between these components.
  • Each component will publish an appropriate set of events or messages to the service bus queue where it is read and processed by the consumer components.
  • Many services will behave as both publisher and subscriber. This enables different development teams to enhance individual components or modules using development language or tools of our choice. 

Conclusion

Today interconnectivity has become a core architectural need. EDA enables different independent systems to connect seamlessly. 

It is a good fit for systems where:
  • Low latency and near real time responsive times are crucial.
  • Two-phase commit or processing order is important.
  • Traditional batch processing or data collection methodologies need to be replaced.
  • A need of highly scalable, consistent, and always available systems. 

——————————————————————————————————————————-

A Blog By Debashish Satapathy

Debashish leads the Engineering team at Kshema. As the Principal Technologist, he is contributing to the re-architecture of the existing technology of insurance platform to our new age platform, Kshema which aims to help millions of farmers to avail our crop insurance products.

Debashish is a passionate believer in investing in others, whether it is individuals, organizations or the entire industry. He loves to see people excel and likes contributing to their success.

Other blogs you might like