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.
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-bookBook rental car -
flight-bookBook flight -
flight-cancelCancel flight -
hotel-bookBook hotel -
hotel-releaseRelease hotel hold -
traveller-notifyNotify traveller: not booked, Send itinerary
Files · 2
- travel-booking-saga.bpmn Process model
- travel-booking-saga.bpmn.tests.json Test scenarios (runScenario format)
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.