Welcome to FlowZap, the App to diagram with Speed, Clarity and Control.

Saga Pattern Workflow

patterns

Saga orchestration pattern for distributed transactions across Order, Payment, and Shipping services with automatic compensation rollback on failures.

Full FlowZap Code

Orchestrator { # Saga Orchestrator
n1: circle label:"Start"
n2: rectangle label:"Begin distributed transaction"
n3: rectangle label:"Coordinate saga steps"
n4: rectangle label:"Commit saga"
n5: rectangle label:"Trigger compensations"
n6: circle label:"End"
n1.handle(right) -> n2.handle(left)
n2.handle(bottom) -> OrderService.n7.handle(top) [label="Step 1"]
n3.handle(bottom) -> PaymentService.n11.handle(top) [label="Step 2"]
n4.handle(right) -> n6.handle(left)
n5.handle(bottom) -> PaymentService.n15.handle(top) [label="Rollback"]
}
OrderService { # Order Service
n7: rectangle label:"Create order record"
n8: diamond label:"Order created?"
n9: rectangle label:"Reserve inventory"
n10: rectangle label:"Cancel order"
n7.handle(right) -> n8.handle(left)
n8.handle(right) -> n9.handle(left) [label="Yes"]
n8.handle(bottom) -> n10.handle(top) [label="No"]
n9.handle(top) -> Orchestrator.n3.handle(bottom) [label="Success"]
n10.handle(top) -> Orchestrator.n5.handle(bottom) [label="Failed"]
}
PaymentService { # Payment Service
n11: rectangle label:"Process payment"
n12: diamond label:"Payment successful?"
n13: rectangle label:"Confirm transaction"
n14: rectangle label:"Report payment failure"
n15: rectangle label:"Refund payment"
n16: rectangle label:"Release inventory"
n11.handle(right) -> n12.handle(left)
n12.handle(right) -> n13.handle(left) [label="Yes"]
n12.handle(bottom) -> n14.handle(top) [label="No"]
n13.handle(bottom) -> ShippingService.n17.handle(top) [label="Step 3"]
n14.handle(top) -> Orchestrator.n5.handle(bottom) [label="Compensate"]
n15.handle(right) -> n16.handle(left)
n16.handle(top) -> OrderService.n10.handle(bottom) [label="Undo order"]
}
ShippingService { # Shipping Service
n17: rectangle label:"Schedule shipment"
n18: diamond label:"Shipment scheduled?"
n19: rectangle label:"Generate tracking number"
n20: rectangle label:"Report shipping failure"
n17.handle(right) -> n18.handle(left)
n18.handle(right) -> n19.handle(left) [label="Yes"]
n18.handle(bottom) -> n20.handle(top) [label="No"]
n19.handle(top) -> Orchestrator.n4.handle(bottom) [label="Complete"]
n20.handle(top) -> Orchestrator.n5.handle(bottom) [label="Compensate"]
}

Related templates

Api Gateway Workflow

patterns

API Gateway pattern with request authentication, rate limiting, request routing to backend services, response aggregation, and error handling.

Circuit Breaker Workflow

patterns

Circuit breaker resilience pattern with closed, open, and half-open states for protecting services from cascading failures with automatic recovery testing.

Cqrs Workflow

patterns

CQRS (Command Query Responsibility Segregation) pattern with separate command and query paths, domain event publishing, read model synchronization, and DTO transformation.