Event-Driven Architecture Expert
Design and implement resilient message-driven systems using Kafka, RabbitMQ, Redis Streams, and cloud-native event buses.
Activation Triggers
Activate on: "event-driven", "message queue", "pub/sub", "Kafka", "RabbitMQ", "event bus", "async messaging", "dead letter queue", "event broker", "fan-out", "Redis Streams"
NOT for: CQRS projections/event stores → cqrs-event-sourcing-architect | WebSocket real-time → websocket-realtime-expert | Distributed tracing → observability-apm-expert
Quick Start
- Identify event boundaries — map domain events to bounded contexts
- Choose broker — Kafka for ordered logs, RabbitMQ for routing flexibility, Redis Streams for lightweight queues
- Define event schemas — use CloudEvents spec with JSON Schema or Avro
- Implement idempotent consumers — design for at-least-once delivery
- Configure DLQ and retry policies — never silently drop messages
Core Capabilities
| Domain |
Technologies |
| Message Brokers |
Apache Kafka 3.8+, RabbitMQ 4.x, Redis Streams 7.4 |
| Cloud-Native |
AWS EventBridge, GCP Pub/Sub, Azure Service Bus |
| Schema Registry |
Confluent Schema Registry, AWS Glue, Apicurio |
| Serialization |
CloudEvents 1.0, Avro, Protobuf, JSON Schema |
| Frameworks |
KafkaJS, amqplib, BullMQ 5.x, Temporal |
Architecture Patterns
Fan-Out with Dead Letter Queue
Producer → Topic/Exchange
├─→ Consumer A (order-service)
├─→ Consumer B (notification-service)
└─→ Consumer C (analytics-service)
↓ (failure after 3 retries)
Dead Letter Queue → Alert + Manual Review
Transactional Outbox Pattern
Avoid dual-write problems by writing events to an outbox table within the same DB transaction, then polling/CDC to publish:
┌─────────────────────────────┐
│ BEGIN TRANSACTION │
│ INSERT INTO orders (...) │
│ INSERT INTO outbox ( │
│ event_type, payload, │
│ published_at = NULL │
│ ) │
│ COMMIT │
└─────────────────────────────┘
↓ (CDC / Poller)
Kafka / RabbitMQ Topic
Competing Consumers with Partitioned Ordering
// KafkaJS consumer group — 3 partitions, 3 consumers
const kafka = new Kafka({ brokers: ['broker:9092'] });
const consumer = kafka.consumer({ groupId: 'order-processors' });
await consumer.subscribe({ topic: 'orders', fromBeginning: false });
await consumer.run({
partitionsConsumedConcurrently: 3,
eachMessage: async ({ topic, partition, message }) => {
const event = JSON.parse(message.value.toString());
await processIdempotent(event, message.headers['idempotency-key']);
},
});
Anti-Patterns
- No idempotency — consumers must tolerate duplicate delivery; use idempotency keys stored in Redis or a DB unique constraint
- Unbounded retry loops — always set max retries with exponential backoff, then route to DLQ
- Synchronous over async — do not await downstream completion in the producer; fire-and-forget with ack
- Oversized payloads — keep events under 1MB; use claim-check pattern for large blobs (store in S3, pass reference)
- Missing schema evolution — always version your event schemas; breaking changes require a new topic or dual-publish
Quality Checklist
1---2license: Apache-2.03name: event-driven-architecture-expert4description: "Message queues, pub/sub, event sourcing with Kafka, RabbitMQ, Redis Streams. Activate on: event-driven, message queue, pub/sub, Kafka, RabbitMQ, event bus, async messaging, dead letter queue. NOT for: CQRS projections (use cqrs-event-sourcing-architect), real-time WebSocket (use websocket-realtime-expert), observability (use observability-apm-expert)."5allowed-tools: Read,Write,Edit,Bash(npm:*,npx:*,docker:*)6category: Backend & Infrastructure7tags:8 - event-driven9 - kafka10 - messaging11 - pub-sub12 - rabbitmq13pairs-with:14 - skill: cqrs-event-sourcing-architect15 reason: Event sourcing builds on event-driven foundations16 - skill: streaming-pipeline-architect17 reason: Streaming pipelines consume event-driven sources18 - skill: observability-apm-expert19 reason: Distributed tracing across async event flows20metadata:21 source: https://skillmd.com/skills/curiositech/event-driven-architecture-expert22---2324# Event-Driven Architecture Expert2526Design and implement resilient message-driven systems using Kafka, RabbitMQ, Redis Streams, and cloud-native event buses.2728## Activation Triggers2930**Activate on:** "event-driven", "message queue", "pub/sub", "Kafka", "RabbitMQ", "event bus", "async messaging", "dead letter queue", "event broker", "fan-out", "Redis Streams"3132**NOT for:** CQRS projections/event stores → `cqrs-event-sourcing-architect` | WebSocket real-time → `websocket-realtime-expert` | Distributed tracing → `observability-apm-expert`3334## Quick Start35361. **Identify event boundaries** — map domain events to bounded contexts372. **Choose broker** — Kafka for ordered logs, RabbitMQ for routing flexibility, Redis Streams for lightweight queues383. **Define event schemas** — use CloudEvents spec with JSON Schema or Avro394. **Implement idempotent consumers** — design for at-least-once delivery405. **Configure DLQ and retry policies** — never silently drop messages4142## Core Capabilities4344| Domain | Technologies |45|--------|-------------|46| **Message Brokers** | Apache Kafka 3.8+, RabbitMQ 4.x, Redis Streams 7.4 |47| **Cloud-Native** | AWS EventBridge, GCP Pub/Sub, Azure Service Bus |48| **Schema Registry** | Confluent Schema Registry, AWS Glue, Apicurio |49| **Serialization** | CloudEvents 1.0, Avro, Protobuf, JSON Schema |50| **Frameworks** | KafkaJS, amqplib, BullMQ 5.x, Temporal |5152## Architecture Patterns5354### Fan-Out with Dead Letter Queue5556```57Producer → Topic/Exchange58 ├─→ Consumer A (order-service)59 ├─→ Consumer B (notification-service)60 └─→ Consumer C (analytics-service)61 ↓ (failure after 3 retries)62 Dead Letter Queue → Alert + Manual Review63```6465### Transactional Outbox Pattern6667Avoid dual-write problems by writing events to an outbox table within the same DB transaction, then polling/CDC to publish:6869```70┌─────────────────────────────┐71│ BEGIN TRANSACTION │72│ INSERT INTO orders (...) │73│ INSERT INTO outbox ( │74│ event_type, payload, │75│ published_at = NULL │76│ ) │77│ COMMIT │78└─────────────────────────────┘79 ↓ (CDC / Poller)80 Kafka / RabbitMQ Topic81```8283### Competing Consumers with Partitioned Ordering8485```typescript86// KafkaJS consumer group — 3 partitions, 3 consumers87const kafka = new Kafka({ brokers: ['broker:9092'] });88const consumer = kafka.consumer({ groupId: 'order-processors' });89await consumer.subscribe({ topic: 'orders', fromBeginning: false });90await consumer.run({91 partitionsConsumedConcurrently: 3,92 eachMessage: async ({ topic, partition, message }) => {93 const event = JSON.parse(message.value.toString());94 await processIdempotent(event, message.headers['idempotency-key']);95 },96});97```9899## Anti-Patterns1001011. **No idempotency** — consumers must tolerate duplicate delivery; use idempotency keys stored in Redis or a DB unique constraint1022. **Unbounded retry loops** — always set max retries with exponential backoff, then route to DLQ1033. **Synchronous over async** — do not await downstream completion in the producer; fire-and-forget with ack1044. **Oversized payloads** — keep events under 1MB; use claim-check pattern for large blobs (store in S3, pass reference)1055. **Missing schema evolution** — always version your event schemas; breaking changes require a new topic or dual-publish106107## Quality Checklist108109- [ ] All events follow CloudEvents spec with `type`, `source`, `id`, `time`110- [ ] Consumers are idempotent (replay-safe)111- [ ] Dead letter queues configured with alerting112- [ ] Schema registry enforces backward compatibility113- [ ] Retry policy: exponential backoff, max 3-5 retries114- [ ] Partition key chosen to preserve ordering where required115- [ ] Consumer lag monitoring configured (Kafka) or queue depth alerts (RabbitMQ)116- [ ] Transactional outbox used to avoid dual-write inconsistency117- [ ] Event payloads under 1MB (claim-check for larger)118- [ ] Load tested at 2x expected peak throughput