Asynchronous Messaging and Event-Driven Architecture
Trace message-oriented middleware and event-driven architecture from enterprise queues to Kafka at LinkedIn and Apache Iggy, with real-world cases and small RabbitMQ/Kafka demos.
Learning Objectives
Explain the evolution from enterprise messaging to retained event streams.
Distinguish commands, events, competing consumers, and independent subscribers.
Trace RabbitMQ publisher confirms, consumer acknowledgements, and redelivery.
Explain Kafka partitions, offsets, consumer groups, retention, and replay.
Locate the failure window between a business effect and progress recording.
Choose a messaging design and define recovery and observability requirements.
Use documented enterprise cases and implementation evidence to evaluate Kafka, queues, and Iggy.
Combine synchronous tools, event streams, and human approval in a recoverable agentic workflow.
Core Concepts
Message-oriented middleware
Infrastructure mediating message exchange, routing, storage, and delivery between applications.
Event-driven architecture
Services publish facts and react through explicit event contracts and subscriptions.
Queue
Pending deliveries shared by competing workers in the RabbitMQ example.
Exchange and binding
RabbitMQ routing rules connecting publication to one or more queues.
Topic and partition
Kafka records organized into ordered logs within a named topic.
Consumer group
Kafka consumers sharing partition ownership and committed progress for one application.
Idempotent effect
Repeating a logical operation leaves the same intended business result.
Diagrams
Independent reactions to OrderConfirmed
flowchart LR
O[Ordering owns confirmation] -->|OrderConfirmed| B[Event distribution]
B --> P[Pickup subscription]
B --> A[Analytics subscription]
P --> W[Prepare pickup]
A --> R[Update report]
Ordering publishes a completed business transition. Pickup and analytics have independent subscriptions and reactions. Their completion times differ; the customer should see the real workflow state.
RabbitMQ pickup workers share one queue
flowchart LR
P[Job producer] --> E[Default exchange]
E --> Q[Durable pickup queue]
Q --> A[Worker A]
Q --> B[Worker B]
A -->|ACK after effect| Q
B -->|ACK after effect| Q
The producer routes jobs to one queue. A and B compete for its deliveries. Each worker acknowledges after its simulated effect; loss before acknowledgement permits redelivery.
Each subscriber owns a queue
flowchart LR
P[Event producer] --> X[Fanout exchange]
X --> Q1[Pickup queue]
X --> Q2[Analytics queue]
Q1 --> W1[Pickup worker]
Q2 --> W2[Analytics worker]
The exchange routes a publication to two bound queues. Pickup and analytics each receive a logical copy; multiple workers attached to either queue share that subscriber’s work.
Independent groups read retained order events
flowchart LR
P[Order producer] --> T[Orders topic - partition 0]
T --> G[Pickup group - own offset]
T --> A[Analytics group - own offset]
T --> R[New replay group - earliest retained offset]
Each group reads the same retained partition with independent progress. A new group can start at the earliest available record. Reads do not delete records, but retention can remove old history.
Event-driven travel recovery with approved actions
flowchart LR
D[Trip disrupted] --> K1[Kafka disruption topic]
K1 --> A[Planner agent]
A -->|RPC| S[Mock search API]
A --> P[Proposal topic and stored plan]
P --> H[Human approval]
H --> K2[Kafka approval topic]
K2 --> E[Executor]
E -->|RPC with operation key| B[Mock booking API]
E --> O[Kafka outcome topic]
O --> U[Status and audit]
A disruption triggers planning. The planner calls a mock search API and publishes a proposal. A human approves its exact version. The executor calls the mock booking API with a stable operation key and publishes an outcome for status and audit. Durable application state supports recovery at every step.
Examples, Discussions, and Project Ideas
Slide 2: Message-oriented middleware: why it exists
MOM lets applications exchange messages through managed infrastructure.
Store-and-forward bridges applications that are not available at the same time.
Routing, persistence, acknowledgements, and access control move into shared infrastructure.
A broker reduces temporal coupling; schemas and business meaning still couple applications.