CodeHive
open main menu
System Design roadmap hero image
Part of series: System Design Roadmap

Week 5 Day 4: Event-Driven Architecture - Reacting to Change

/ 1 min read

In a Monolith, Service A calls function B. In Event-Driven, Service A shouts “Something happened!” and B reacts.

Request-Driven (REST/gRPC)

  • Order Svc calls Inventory Svc.
  • Inventory Svc calls Shipping Svc.
  • Tight Coupling: If Shipping is down, Order fails.

Event-Driven

  • Order Svc emits OrderPlaced.
  • Inventory Svc consumes OrderPlaced, emits InventoryReserved.
  • Shipping Svc consumes InventoryReserved, emits PackageSent.
  • Loose Coupling: Services don’t know each other exists.

Choreography vs Orchestration

  1. Choreography: Dancers knowing their own steps. (Services react to events independently).
    • Hard to visualize the whole flow.
    • Flexible.
  2. Orchestration: A Conductor (Orchestrator Service) tells everyone what to do.
    • “Inventory, reserve items.” -> “Done”.
    • “Shipping, ship items.” -> “Done”.
    • Easier to debug.

Pros & Cons

  • Pros: Scalable, Resilient, Easy to add new features.
  • Cons: Complexity. Hard to debug “Why didn’t the shipping happen?” (Traceability).

Tomorrow: Mini Project. We build a robust Job Queue system! 👷


Next Step

Next: Mini Project →