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

Workflow du pattern Saga

patterns

Pattern d’orchestration Saga pour transactions distribuées entre les services Commande, Paiement et Expédition avec compensation et retour arrière automatiques en cas d’échec.

Code FlowZap complet

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"]
}

Modèles associés

Workflow de passerelle API

patterns

Schéma de passerelle API avec authentification des requêtes, limitation de débit, routage des requêtes vers les services backend, agrégation des réponses et gestion des erreurs.

Processus de déploiement blue-green

patterns

Schéma de déploiement blue-green avec configuration d’environnements parallèles, tests de fumée (smoke tests), bascule du trafic via l’équilibreur de charge et capacité de retour arrière instantané.

Flux de travail CQRS

patterns

Patron CQRS (Command Query Responsibility Segregation) avec chemins de commande et de requête séparés, publication d'événements de domaine, synchronisation du modèle de lecture et transformation DTO.