Demystifying Event-Driven Architecture and Interaction models:

Harsh Mighlani
4 min readJan 18, 2024

Event-Driven Architecture is an architectural pattern where the flow of the application is determined by events, such as user actions, sensor outputs, or messages from other systems. In an event-driven system, the processing of information is triggered by events rather than being controlled by a central flow of control.

Key Components of EDA:

  1. Events: These are the triggers or signals representing changes or occurrences in the system.
  2. Event Producers: Components or systems that generate and emit events.
  3. Event Consumers: Components or systems that react to and process events.
  4. Event Bus/Hub: Infrastructure facilitating communication between event producers and consumers.

Advantages of EDA

  1. Real-Time Responsiveness: Enables instant reactions to events for real-time updates and interactions.
  2. Scalability: Supports efficient scaling by allowing independent handling of workloads.
  3. Loose Coupling: Enhances flexibility and maintainability through reduced inter-component dependencies.
  4. Flexibility and Adaptability: Facilitates quick adaptation to changing requirements and business conditions.
  5. Event Logging and Auditing: Provides a comprehensive audit trail for troubleshooting and compliance purposes.
  6. Enhanced Decoupling: Improves system resilience and fault isolation by minimizing dependencies.
  7. Support for Microservices Architecture: Aligns well with microservices, promoting modularity and distribution.
  8. Improved Extensibility: Simplifies the introduction of new features or components by reacting to events.

Practical Example

Consider an e-commerce platform where events like “Order Placed,” “Account Creation,” or “List Order” trigger various processes within the system.

Below screenshots are from ReInvent session (must see):

AWS Keynote -> https://www.youtube.com/watch?v=RfvL_423a-I

Webhooks: Enabling Real-Time Communication

Defining Webhooks

Webhooks are a practical implementation of event-driven architecture. They provide a lightweight and efficient means for one system to notify another about events in real-time. Unlike traditional polling mechanisms, webhooks operate on a push model, delivering event data to a specified endpoint when an event occurs.

Key Characteristics of Webhooks:

  1. Subscription: A system subscribes to events by providing a URL endpoint.
  2. Push Model: Event data is pushed to the listener when an event occurs.
  3. Payload: HTTP POST requests carry event data in a structured payload.

Advantages of Webhooks

  • Real-Time Updates: Immediate communication enables real-time updates.
  • Efficiency: Reduces unnecessary requests by delivering data only when an event occurs.
  • Automation: Commonly used to automate processes triggered by external events.

Illustrative Example

In a webhook scenario, envision an application receiving notifications when a new message is posted in a chat system. Webhooks facilitate seamless communication and automation in response to these events.

Mechanisms for Event Driven Component Interaction:

Below grid shows various mechanism and corresponding attributes around them:

SQS- Simple Queue Service serves point to point communication and is an essential component in the scenario when you need to build asynchronous communication between consumers and producers.

Amazon provide DLQ- called Dead Letter Queue for storing failed invocation and mechanism for retriggering failed events.

SQS- Queueing Service for point to point communication
SQS- Point to Point Communication between producer and consumer

SNS — Simple Notification Service is topic subscription model, in the image below, you can filter out various events basis criteria around type/attribute of payload or metadata of message and then push the event to corresponding queue. This way you achieve segregation of messages and achieve faster subscription for each of these messages.

SNS- Via a topic from one producer to multiple consumers

Event Sourcing — Streaming is a concept that comes into picture when large volume of data is expected to be processed in a short interval of time. Kinesis as an example, works on Partitions and can propogate messages to various downstream subscribers providing quick and efficient orchestration of messages.

Step Function: AWS Step Functions is a fully managed service that allows you to create and run serverless workflows using a state machine-based model. It enables the coordination and sequencing of multiple AWS services, facilitating the creation of scalable and resilient applications with features like error handling, integration with various AWS services, and visual representation of workflows. State machines are defined using the Amazon States Language (ASL), and Step Functions provides monitoring and logging capabilities for better visibility into workflow executions.

I’d be writing another one exploring step functions and event bridges merged for the same somewhat similar to below use case:

Thank you if you read it this far..!!

--

--

Harsh Mighlani

AWS certified solutions architect | 12+ Years experienced | Loves Serverless & Containerization use cases.