<mxfile host="thecodeclouds.com" agent="hand-built" version="24.0.0" type="device">
<diagram id="saga" name="2. Checkout saga and compensations"><mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1500" pageHeight="760" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="c1" value="The checkout saga: local transactions forward, compensations backward" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=18;fontColor=#232F3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="16" width="1300" height="24" as="geometry"/></mxCell>
<mxCell id="c2" value="The orchestrator writes its state before every call, so a crash resumes from the last step instead of starting over." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="44" width="1300" height="18" as="geometry"/></mxCell>
<mxCell id="s1" value='&lt;b&gt;Create order&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Order service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;status = PENDING&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="40" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c3" value="1" style="ellipse;html=1;fillColor=#1E8E3E;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="32" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="s2" value='&lt;b&gt;Reserve stock&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Inventory service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;hold expires in 15 min&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="284" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c4" value="2" style="ellipse;html=1;fillColor=#1E8E3E;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="276" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="c5" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="s1" target="s2"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="s3" value='&lt;b&gt;Authorize payment&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Payment service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;money held, not taken&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="528" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c6" value="3" style="ellipse;html=1;fillColor=#1E8E3E;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="520" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="c7" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="s2" target="s3"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="s4" value='&lt;b&gt;Confirm order&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Order service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;status = CONFIRMED&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#E8F0FE;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="772" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c8" value="4" style="ellipse;html=1;fillColor=#1A73E8;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="764" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="c9" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="s3" target="s4"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="s5" value='&lt;b&gt;Commit reservation&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Inventory service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;hold becomes allocation&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#E8F0FE;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="1016" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c10" value="5" style="ellipse;html=1;fillColor=#1A73E8;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="1008" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="c11" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="s4" target="s5"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="s6" value='&lt;b&gt;Capture payment&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Payment service&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;when the parcel ships&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#E8F0FE;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="1260" y="150" width="200" height="74" as="geometry"/></mxCell>
<mxCell id="c12" value="6" style="ellipse;html=1;fillColor=#1A73E8;strokeColor=none;fontColor=#FFFFFF;fontStyle=1;fontSize=12;aspect=fixed;" vertex="1" parent="1"><mxGeometry x="1252" y="140" width="22" height="22" as="geometry"/></mxCell>
<mxCell id="c13" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="s5" target="s6"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c14" style="edgeStyle=none;html=1;rounded=0;strokeColor=#202124;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="750" y="100" as="sourcePoint"/><mxPoint x="750" y="260" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c15" value="PIVOT" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=1;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="710" y="96" width="80" height="18" as="geometry"/></mxCell>
<mxCell id="c16" value="Left of the line: any failure is undone&lt;br&gt;with compensations." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="40" y="98" width="500" height="32" as="geometry"/></mxCell>
<mxCell id="c17" value="Right of the line: no going back. Steps are&lt;br&gt;retried until they succeed (they are idempotent)." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#1A73E8;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="770" y="98" width="520" height="32" as="geometry"/></mxCell>
<mxCell id="k1" value='&lt;b&gt;C1  Cancel order&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;status = CANCELLED, tell shopper&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="40" y="330" width="200" height="60" as="geometry"/></mxCell>
<mxCell id="c18" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="s1" target="k1"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="k2" value='&lt;b&gt;C2  Release stock&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;reserved -= qty (if still held)&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="284" y="330" width="200" height="60" as="geometry"/></mxCell>
<mxCell id="c19" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="s2" target="k2"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c20" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="k2" target="k1"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="k3" value='&lt;b&gt;C3  Void authorization&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;only if PSP says AUTHORIZED&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="528" y="330" width="200" height="60" as="geometry"/></mxCell>
<mxCell id="c21" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="s3" target="k3"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c22" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="k3" target="k2"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c23" value="declined, fraud,&lt;br&gt;or out of retries" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="630" y="250" width="110" height="32" as="geometry"/></mxCell>
<mxCell id="c24" value="Compensations run in reverse order and are idempotent too." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#D93025;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="40" y="405" width="680" height="18" as="geometry"/></mxCell>
<mxCell id="unk" value='&lt;b&gt;Payment timed out?&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;state = PAYMENT_UNKNOWN&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;ask the PSP by idempotency key,&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;then go forward or compensate&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#E8710A;fillColor=#FEF1E3;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="800" y="300" width="300" height="96" as="geometry"/></mxCell>
<mxCell id="c25" style="edgeStyle=none;html=1;rounded=0;strokeColor=#E8710A;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="713" y="224" as="sourcePoint"/><mxPoint x="800" y="348" as="targetPoint"/><Array as="points"><mxPoint x="713" y="285"/><mxPoint x="765" y="285"/><mxPoint x="765" y="348"/></Array></mxGeometry></mxCell>
<mxCell id="c26" value="no answer in 2 s" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#E8710A;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="775" y="262" width="110" height="17" as="geometry"/></mxCell>
<mxCell id="c27" value="&lt;b&gt;Saga state table (checkout DB), the orchestrator's memory&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#1A73E8;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="40" y="460" width="640" height="200" as="geometry"/></mxCell>
<mxCell id="c28" value="checkout_id" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="495" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c29" value="step" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="155" y="495" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c30" value="status" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="320" y="495" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c31" value="attempts" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="450" y="495" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c32" value="updated_at" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="530" y="495" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c33" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=1;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="50" y="515" as="sourcePoint"/><mxPoint x="670" y="515" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c34" value="ck_8812" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="525" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c35" value="AUTHORIZE_PAYMENT" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="155" y="525" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c36" value="IN_PROGRESS" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="320" y="525" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c37" value="2" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="450" y="525" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c38" value="10:41:07.218" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="530" y="525" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c39" value="ck_8813" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="555" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c40" value="CAPTURE_PAYMENT" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="155" y="555" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c41" value="DONE" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="320" y="555" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c42" value="1" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="450" y="555" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c43" value="10:41:09.004" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="530" y="555" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c44" value="ck_8814" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="585" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c45" value="RELEASE_STOCK" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="155" y="585" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c46" value="COMPENSATING" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="320" y="585" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c47" value="1" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="450" y="585" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c48" value="10:41:10.551" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="530" y="585" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c49" value="ck_8815" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="615" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c50" value="AUTHORIZE_PAYMENT" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="155" y="615" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c51" value="UNKNOWN" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#E8710A;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="320" y="615" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c52" value="3" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="450" y="615" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c53" value="10:41:12.930" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="530" y="615" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c54" value="A recovery worker picks up rows stuck IN_PROGRESS for over 30 s and replays that step with the same key." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=10;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="55" y="640" width="620" height="16" as="geometry"/></mxCell>
<mxCell id="c55" value="&lt;b&gt;Rules that keep a saga honest&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#202124;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#202124;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="720" y="460" width="400" height="200" as="geometry"/></mxCell>
<mxCell id="c56" value="1. Save the step, then call. Never the other way round." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="495" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c57" value="2. Every step and compensation is idempotent." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="521" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c58" value='3. A timeout is "unknown", not "failed".' style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="547" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c59" value="4. Nothing irreversible before the pivot." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="573" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c60" value="5. Shoppers see PENDING; email only on CONFIRMED." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="599" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c61" value="6. Alert on sagas older than 10 minutes." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="735" y="625" width="380" height="18" as="geometry"/></mxCell>
<mxCell id="c62" value="&lt;b&gt;Legend&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#9AA0A6;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="1160" y="460" width="320" height="114" as="geometry"/></mxCell>
<mxCell id="c63" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1174" y="498" as="sourcePoint"/><mxPoint x="1214" y="498" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c64" value="compensable step" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1226" y="491" width="244" height="17" as="geometry"/></mxCell>
<mxCell id="c65" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1174" y="519" as="sourcePoint"/><mxPoint x="1214" y="519" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c66" value="retriable step (after pivot)" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1226" y="512" width="244" height="17" as="geometry"/></mxCell>
<mxCell id="c67" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1174" y="540" as="sourcePoint"/><mxPoint x="1214" y="540" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c68" value="compensation" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1226" y="533" width="244" height="17" as="geometry"/></mxCell>
<mxCell id="c69" style="edgeStyle=none;html=1;rounded=0;strokeColor=#E8710A;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1174" y="561" as="sourcePoint"/><mxPoint x="1214" y="561" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c70" value="unknown outcome path" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#3C4043;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1226" y="554" width="244" height="17" as="geometry"/></mxCell>
<mxCell id="c71" value="Choreography (services reacting to each other's events) works for 2 or 3 steps. Past that, an orchestrator&lt;br&gt;with a state table is far easier to debug at 3 a.m.: one row tells you where every checkout is." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="40" y="690" width="1100" height="34" as="geometry"/></mxCell></root></mxGraphModel></diagram>
</mxfile>
