Flight Booking Microservices
Event-Driven Saga Transaction Engine
6-service distributed flight booking with database-per-service isolation, Saga compensation, and end-to-end tracing.
6 Microservices
Saga Orchestration
Redis Locks
OpenTelemetry
The engineering problem
Core Challenge
Preventing double-booking across distributed services without 2PC deadlock overhead.
Architecture Solution
Redis mutex locking with TTL + Saga orchestrator issuing compensating unlock events on payment failure.
Resilience Guardrail
Idempotency-Key header required; RabbitMQ dead-letter queues for deterministic replay.
Service topology & IPC protocols
API Gateway (Envoy)
Reverse proxy, rate limiting, x-request-id
Auth Service
JWT issuance, refresh token rotation, RBAC
Flight Inventory
Seat catalogue, Redis mutex lock with TTL
Booking Coordinator
Saga state machine orchestrator
Payment Service
Stripe/Tranglo idempotency webhook handler
Notification Service
Async ticket generator & PDF dispatcher
- API Gateway — rate limiting & correlation ID injection
- Auth — JWT with RBAC & refresh token rotation
- Flights — inventory search with Redis reservation locks
- Bookings — Saga coordinator for seat holds
- Payments — idempotent webhook processing
- Notifications — async queues via RabbitMQ
Canonical event / payload contract
application/json{
"eventId": "evt_98319f8a",
"eventType": "booking.payment_failed",
"aggregateId": "bk_778102",
"timestamp": "2026-09-01T14:32:00.000Z",
"correlationId": "trace_9921fa4b",
"payload": {
"bookingId": "bk_778102",
"seatNumber": "24A",
"reason": "CARD_DECLINED",
"actionRequired": "COMPENSATE_UNLOCK_SEAT"
}
}