Skip to content

Conversation

@tafaman
Copy link

@tafaman tafaman commented Feb 9, 2026

This PR introduces a complete implementation of the Saga pattern for distributed transactions using AWS Lambda Durable Functions, demonstrating coordinated travel bookings (flight, hotel, car) with automatic compensating transactions on failure.

What's New

Infrastructure (CDK)

  • Lambda Functions: 7 functions total
    • 1 saga orchestrator (durable function) with 1-hour execution timeout
    • 6 service functions (reserve/cancel for flight, hotel, car) with 1-minute timeout
  • DynamoDB Tables: 3 tables for flight bookings, hotel reservations, and car rentals
    • Pay-per-request billing mode
    • Point-in-time recovery enabled
  • CloudWatch Log Groups: Custom log groups for each function with 1-week retention
  • IAM Permissions: Properly scoped permissions for DynamoDB access and Lambda invocations

Saga Pattern Implementation

  • Sequential Execution: Services invoked in order (flight → hotel → car)
  • State Tracking: Each successful operation tracked by the orchestrator
  • Compensating Transactions: Automatic rollback in reverse order on failure
  • Failure Simulation: Built-in failure flags for testing (failBookFlight, failBookHotel, failBookCar)

Testing & Documentation

  • Test Files: 4 ready-to-use test event files
    • test-success.json - All services succeed
    • test-fail-flight-booking.json - Flight fails immediately
    • test-fail-hotel-booking.json - Hotel fails, flight compensated
    • test-fail-car-booking.json - Car fails, hotel and flight compensated
  • Comprehensive Documentation:
    • Main README with architecture diagrams and deployment instructions
    • TESTING.md with detailed test scenarios and validation steps
    • TEST-FILES-README.md explaining each test file
    • Screenshots showing success and failure states

…mentation for distributed transactions. New features include:

- travel booking system coordinating flight, hotel, and car reservations
-  saga orchestrator Lambda function with automatic compensating transactions
- individual service functions for flight, hotel, and car reservations with cancellation
@bfreiberg bfreiberg added the durable functions Pattern for AWS Lambda durable functions label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

durable functions Pattern for AWS Lambda durable functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants