Skip to content
D2 templates

D2 — saga (booking)

Hotel + flight + car saga with compensating actions.

Template previewD2
G client client orchestrator orchestrator client->orchestrator book trip orchestrator->client trip aborted hotel hotel orchestrator->hotel reserve orchestrator->hotel cancel (compensate) flight flight orchestrator->flight book orchestrator->flight cancel (compensate) car car orchestrator->car rent hotel->orchestrator ok flight->orchestrator ok car->orchestrator fail

What this template contains

Source
10 lines

Make it your own.

client -> orchestrator: book trip
orchestrator -> hotel: reserve
orchestrator -> flight: book
orchestrator -> car: rent
hotel -> orchestrator: ok
flight -> orchestrator: ok
car -> orchestrator: fail
orchestrator -> hotel: cancel (compensate)
orchestrator -> flight: cancel (compensate)
orchestrator -> client: trip aborted