File size: 1,931 Bytes
1395e20 cbd4d19 1395e20 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | OrderSystem { # Order System
n1: circle label:"Start"
n2: rectangle label:"Receive order event"
n3: rectangle label:"Load current state"
n4: rectangle label:"Order completed"
n5: circle label:"End"
n1.handle(right) -> n2.handle(left)
n2.handle(right) -> n3.handle(left)
n3.handle(bottom) -> StateMachine.n6.handle(top) [label="Process"]
n4.handle(right) -> n5.handle(left)
}
StateMachine { # State Machine
n6: diamond label:"Current state?"
n7: rectangle label:"Pending to Confirmed"
n8: rectangle label:"Confirmed to Processing"
n9: rectangle label:"Processing to Shipped"
n10: rectangle label:"Shipped to Delivered"
n11: rectangle label:"Any to Cancelled"
n12: diamond label:"Valid transition?"
n13: rectangle label:"Update state"
n14: rectangle label:"Reject invalid transition"
n6.handle(right) -> n7.handle(left) [label="Pending"]
n6.handle(bottom) -> n8.handle(top) [label="Confirmed"]
n6.handle(left) -> n9.handle(top) [label="Processing"]
n7.handle(bottom) -> n12.handle(top)
n8.handle(bottom) -> n12.handle(top)
n9.handle(bottom) -> n12.handle(top)
n10.handle(bottom) -> n12.handle(top)
n11.handle(bottom) -> n12.handle(top)
n12.handle(right) -> n13.handle(left) [label="Yes"]
n12.handle(bottom) -> n14.handle(top) [label="No"]
n13.handle(bottom) -> EventLog.n15.handle(top) [label="Persist"]
n14.handle(top) -> OrderSystem.n4.handle(bottom) [label="Error"]
}
EventLog { # Event Log
n15: rectangle label:"Record state transition"
n16: rectangle label:"Emit state changed event"
n17: diamond label:"Final state?"
n18: rectangle label:"Trigger completion handlers"
n19: rectangle label:"Continue processing"
n15.handle(right) -> n16.handle(left)
n16.handle(right) -> n17.handle(left)
n17.handle(right) -> n18.handle(left) [label="Yes"]
n17.handle(bottom) -> n19.handle(top) [label="No"]
n18.handle(top) -> OrderSystem.n4.handle(bottom) [label="Complete"]
n19.handle(top) -> OrderSystem.n4.handle(bottom) [label="Updated"]
}
|