Templates / Sagas & error handling / travel-booking-saga

Travel Booking Saga

Books a flight, a hotel and a rental car as one unit of work without BPMN compensation events. The bookings run in a sub-process that throws BOOKING_FAILED as soon as a supplier cannot confirm; the error boundary then runs explicit, idempotent undo steps for everything that may already be held and tells the traveller. A trip where all three confirm gets its itinerary.

sagaerror boundarysub-processidempotent undotravel
Open in editor Download .bpmn
casen template use travel-booking-saga
Book trip hotel-failed car-failed car-confirmed Cancelflight Releasehotel hold Notifytraveller:not booked Senditinerary Book flight Book hotel Book rentalcar Trip requested Booking failed Trip not booked Trip confirmed Hotel confirmed? Car confirmed?

Scenarios · 3

  • Flight, hotel and car all confirm book-flight → book-hotel → book-car → trip-booked → send-itinerary → trip-confirmed
  • No hotel: the flight is cancelled and the traveller told book-hotel → hotel-unavailable → on-booking-failed → cancel-flight → trip-not-booked
  • No car: flight and hotel are both undone book-car → car-unavailable → cancel-flight → release-hotel → trip-not-booked

Job types · 6

  • car-book Book rental car
  • flight-book Book flight
  • flight-cancel Cancel flight
  • hotel-book Book hotel
  • hotel-release Release hotel hold
  • traveller-notify Notify traveller: not booked, Send itinerary

Files · 2

Every scenario passes on @bpmnkit/engine's runScenario in the package's tests. casen template use travel-booking-saga [dir] writes the files above into your project — see the templates guide for running the scenarios and deploying.