Event Driven Design & Message Driven Design

Event Driven Design (EDD)

Before we dive into EDD, let’s define an event. An event is immutable and represents a state change in the past.

The core idea of EDD is that systems react to events, facts that something has already happened. In EDD, producers don’t know who consumes the events, hence achieving high decoupling.

Typical flow

  1. A service performs an action
  2. It publishes an event
  3. Zero or more consumers react independently

Example: Order Service successfully creates an order, and emits an event.

The consumers in this scenario could be:

  • Inventory Service reduces stock
  • Email Service sends confirmation
  • Analytics Service tracks metrics

Common Misconception

A common pitfall of developers is expecting replies from events. Events are one-way notifications, not conversations. When you publish an event, you are saying “this happened”, not “please respond”.

Message Driven Design (MDD)

Unlike EDD that reacts to things that have already happened, MDD instructs services to perform actions. These systems send messages to request work from another system.

Messages are intent-based (eg. ProcessPayment, SendEmail, GenerateInvoice) and sender often expects processing to occur.

Typical flow

  1. Sender sends a message
  2. Receiver processes it
  3. Optional response or acknowledgment

Example: Order Service sends a ProcessPayment message to Payment Service

When to use EDD or MDD?

A useful mental model for choosing between the two is that one is reactive and the other is instructive: ‘an order was placed’ versus ‘place an order’. Most modern architectures combine both, where commands initiate work and events announce results.

Example

Checkout Service
   ├─ sends → ProcessPayment (message)
   └─ publishes → PaymentCompleted (event)
Total
0
Shares
Leave a Reply

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

Previous Post

Gaomon Finally Released Full-Featured Linux Drivers for Their Graphic Tablets

Related Posts