Skip to main content
PreparationZone Logo
PrepZone

Event-Driven Architecture

Publish events, react asynchronously and build systems that scale by adding consumers.

Pass checkpoint below

When a StreamHub creator goes live, the stream service publishes stream.started. Notification, analytics, search, and moderation services each react independently — no central orchestrator, no synchronous call chain that breaks when one service is slow.

Events vs commands

AspectEvent (past tense)Command (imperative)
Namingstream.started, payment.completedSendNotification, ProcessPayment
CouplingPublisher doesn't know subscribersSender knows receiver
RoutingTopic/bus; many consumersPoint-to-point queue
FailureOne slow consumer doesn't block othersBlocked queue stalls sender
StreamHubKafka topic `stream.lifecycle`RabbitMQ transcode job queue
  • Naming

    Event (past tense)stream.started, payment.completed
    Command (imperative)SendNotification, ProcessPayment
  • Coupling

    Event (past tense)Publisher doesn't know subscribers
    Command (imperative)Sender knows receiver
  • Routing

    Event (past tense)Topic/bus; many consumers
    Command (imperative)Point-to-point queue
  • Failure

    Event (past tense)One slow consumer doesn't block others
    Command (imperative)Blocked queue stalls sender
  • StreamHub

    Event (past tense)Kafka topic `stream.lifecycle`
    Command (imperative)RabbitMQ transcode job queue

Event-driven flow

Amazon MSK event pipeline

produceCOMPUTE
EKS APIorder placed
INTEGRATION
Amazon MSKorders.placed.v1
COMPUTE
InventoryEKS worker
COMPUTE
Email svcEKS worker
ANALYTICS
AnalyticsFlink / EMR
API publishes events; worker fleets scale independently on consumer lag.

StreamHub production architecture (AWS)

HTTPSstaticmissAPICLIENT
Mobile / WebStreamHub cli…
NETWORK
Route 53GeoDNS routing
NETWORK
CloudFrontCDN + WAF edge
NETWORK
AWS ALBTLS terminati…
NETWORK
API GatewayJWT · rate li…
STORAGE
Amazon S3media origin
COMPUTE
Amazon EKSAPI · auth · …
DATABASE
ElastiCachesessions · ho…
DATABASE
RDS Postgresprimary + rep…
INTEGRATION
Amazon MSKdomain events
ANALYTICS
OpenSearchstream discov…
OPS
CloudWatchmetrics · X-R…
End-to-end path from user to data — reference this when placing any new service.

EDA building blocks

  • Event: Immutable record of something that happened, with schema version.
  • Event bus / broker: Kafka topic or cloud event bridge routing events to subscribers.
  • Event handler: Stateless consumer that reacts to one event type.
  • Event store (optional): Append-only log as source of truth (event sourcing).
  • Schema registry: Enforces Avro/Protobuf/JSON Schema compatibility across producers.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 3 sections

  • Choreography vs orchestration
  • Event schema example
  • Handling failures in EDA

Test yourself

Answer these before moving on — recall is what makes it stick.