πŸš€ Unlocking the Power of Event-Driven Architecture with Routing Conventions

Jason Conway-Williams
6 min readFeb 26, 2025

--

🌟 The Benefits of Event-Driven Architecture (EDA)

Event-Driven Architecture (EDA) is transforming how modern enterprises build scalable, resilient, and decoupled systems. By shifting away from synchronous request-response models, EDA enables asynchronous communication, allowing systems to remain highly available and performant under variable workloads.

πŸ”Ή Key Benefits of EDA:

  1. πŸ“ˆ Scalability & Flexibility: Systems can scale independently based on demand, allowing better resource allocation.
  2. πŸ”— Loose Coupling: Services publish and consume events without knowing each other’s internal workings.
  3. πŸ› οΈ Resilience: Failures in one service do not directly impact others, ensuring higher availability.
  4. ⚑ Real-Time Processing: Events are processed as they occur, enabling faster decision-making and automation.
  5. πŸ‘¨β€πŸ’» Improved Developer Autonomy: Teams can work on their domains without unnecessary interdependencies.

⏳ Eventual Consistency in EDA

One of the fundamental shifts when adopting EDA is embracing eventual consistency. Many processes do not require strict synchronisation; instead, they can operate with a slight delay while data propagates across systems asynchronously.

For example, in an πŸ›’ e-commerce system:

  • A customer places an order πŸ›οΈ, generating an event.
  • The inventory service πŸͺ processes the order and updates stock levels asynchronously.
  • A notification service triggers an email confirmation πŸ“© when order processing is complete.

These actions happen independently without requiring all services to be tightly coupled or execute synchronously. In most business scenarios, eventual consistency is acceptable and beneficial, leading to improved scalability and resilience.

πŸ› οΈ The Need for Planning in Domain-Driven Teams

Implementing EDA across multiple domain-driven teams requires careful planning to prevent unnecessary coupling between teams and services. Without clear conventions, teams might struggle with event naming, structure, or discoverability, leading to inefficiencies and redundant event processing.

To maintain autonomy and ensure smooth integration, teams need to follow a standardised routing convention that simplifies event discovery and consumption.

πŸ“Œ Introducing an Event Routing Convention

A well-defined event routing convention enables teams to produce and consume events efficiently without requiring deep knowledge of other domains. This ensures that:

  • Teams can subscribe to relevant events without depending on specific producers.
  • Event processing remains consistent and predictable across multiple teams.
  • The system remains loosely coupled, improving maintainability and scalability.

πŸ”§ How the Proposed Event Routing Convention Works

The routing convention revolves around embedding structured metadata within event payloads. This metadata includes fields that allow teams to filter, categorise, and consume events effectively.

πŸ“œ Standard Event Structure

{
"metaData": {
"id": "29a6e8a8-0a46-4773-abc5-78bd1013b66f",
"domain": "Product",
"source": "ProductAPI",
"detailType": "ProductCreated",
"country": "GB",
"version": "1.2.1",
"correlationId": "b12345-67890",
"causationId": "c09876-54321"
},
"data": {
"productId": "123456",
"name": "New Laptop"
}
}

πŸ” Key Metadata Fields & Their Purpose

By embedding routing metadata, event consumers can subscribe to relevant events using flexible filtering strategies:

  • Filter by event type: metaData.detailType = "ProductCreated"
  • Filter by service and event type: metaData.source = "ProductAPI" AND metaData.detailType = "ProductCreated"
  • Filter by service and event type: metaData.source = "ProductAPI" AND metaData.detailType = "ProductCreated"
  • Filter by domain and version: metaData.domain = "Product" AND metaData.version >= "1.0.0"
  • Filter by domain and version: metaData.domain = "Product" AND metaData.version >= "1.0.0"

πŸ›°οΈ Using AWS SNS & EventBridge for Event Routing

AWS provides powerful services for event-driven architectures, with SNS and EventBridge being essential tools for event routing based on order requirements:

πŸ“Œ AWS SNS for Ordered Events

AWS Simple Notification Service (SNS) is ideal for handling ordered events, particularly when event consumers need to process messages in a strict sequence. This is especially relevant for order-related events such as:

  • OrderPlaced πŸ›οΈ
  • OrderConfirmed βœ…
  • OrderShipped 🚚

How SNS Ensures Ordered Event Processing

  • FIFO Topics: SNS supports FIFO (First-In-First-Out) topics, ensuring event ordering and exactly-once message delivery.
  • Message Group ID: Events from the same order are assigned the same message group ID, ensuring correct sequencing for consumers.
  • SNS to SQS Integration: Consumers receive messages via Amazon SQS FIFO queues, maintaining strict ordering.

🌎 AWS EventBridge for Unordered Events

For events that do not require strict ordering, Amazon EventBridge is the preferred solution. This is useful for asynchronous event propagation across services where event order does not impact business logic, such as:

  • ProductCreated πŸ—οΈ
  • InventoryUpdated πŸ“¦
  • CustomerProfileUpdated πŸ§‘β€πŸ’»

How EventBridge Enables Flexible Event Routing

  • Event Rules & Filters: EventBridge routes events based on metadata, allowing services to subscribe only to relevant events.
  • Schema Registry: Standardised event schemas ensure compatibility across teams.
  • Multiple Event Targets: Events can be sent to AWS Lambda, Step Functions, and other AWS services dynamically.

πŸ†š SNS vs EventBridge: When to Use What?

πŸ“š Understanding Event Types & Documentation

For teams to effectively consume events, it is essential to have clear documentation that defines the structure of events and their associated routing metadata. Proper documentation ensures that teams understand:

  • The types of events a producer provides
  • How to consume the event
  • How to implement custom filters using metadata properties

πŸ—‚οΈ Central Event Documentation Registry

To ensure consistency across teams, the organisation should maintain a central event document registry that is accessible to all teams. This registry serves as a single source of truth for:

  1. Event Structure Definitions β€” JSON schemas outlining the format of each event.
  2. Metadata Fields & Routing Rules β€” Explanation of routing keys, attributes, and filtering options.
  3. Subscription Guidelines β€” How teams can subscribe to and consume events using AWS SNS or EventBridge filters.
  4. Versioning & Deprecation Policies β€” Ensuring consumers can adapt to evolving event schemas.

πŸ” Example Event Documentation

A typical event documentation entry may look like this:

This documentation enables consumers to implement targeted event filters, ensuring that they receive only relevant events while avoiding unnecessary noise.

By maintaining an up-to-date registry, teams can confidently integrate with event producers, fostering better collaboration and interoperability across the organisation.

πŸ›‘οΈ How Routing Conventions Decouple Teams

1️⃣ Eliminates Direct Dependencies

Producers and consumers remain unaware of each other’s existence. They only interact through events, reducing inter-team coordination overhead.

2️⃣ Enables Dynamic Event Subscription

Consumers do not need to modify producer logic to receive new events. They simply subscribe to relevant metadata patterns.

3️⃣ Supports Independent Deployments

Teams can upgrade or change their services without impacting others, as long as event structures adhere to versioning rules.

4️⃣ Reduces Complexity in Large Organisations

With many teams working independently, routing conventions ensure that events are structured in a predictable way, avoiding inconsistencies and duplication.

βœ… Conclusion

Embracing event-driven architecture brings significant benefits to modern enterprises, including scalability, resilience, and autonomy. However, without proper planning, teams may struggle with event management and coordination.

By implementing a structured event routing convention, organisations can ensure seamless event discovery, consumption, and processing. This approach decouples teams, enabling them to work independently while maintaining a highly flexible and scalable architecture.

With a well-defined event routing strategy, teams can focus on building domain-specific functionalities while ensuring interoperability across the entire system. πŸš€

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jason Conway-Williams
Jason Conway-Williams

Written by Jason Conway-Williams

Cloud Solutions Architect at City Electrical Factors (CEF)

No responses yet

Write a response