Skip to content
Sequence & interaction templates

Teaching Case — Two Concurrent Branches Addressing One Service

Both branches of the `par` run at the same time and both send to the ledger, so as drawn the order of arrival is not determined — and neither branch shows the other. The engine reports the ledger and stays silent about the forking lifeline, which is in every branch by construction as both the sender and the recipient of the replies; getting that narrowing wrong makes the check fire on every realistic `par`. A lifeline that IS safe to address concurrently says so with `concurrent`, and is then exempt by declaration rather than by this engine guessing which services are stateless.

Template previewSequence & interaction
Settlement fan-out7 messages · deepest 1 openpardebitfeedebit(4200)posteddebiteddebit(35)postedfee.postedsettledSettlement sagaLedgerNotifierEvent busconcurrentNothing here contradicts itself, and 1 thing is probably not what was meant — over 4 lifelines and 7 messages.WARN`Ledger` receives messages in two branches of the `par` on line 8 — `debit` and `fee`. Those branches run at the same time, so as drawn the order ofarrival is not determined. If it is safe to address concurrently, say so: `participant Ledger … concurrent`.INFO4 lifelines, 7 messages, 1 fragment. 2 synchronous calls, 2 answered; the deepest point of the interaction has 1 call open at once. Every message stateswhether it is a call, a reply or a fire-and-forget, so the stack above was simulated rather than guessed at.OK16 of the 17 checks ran over every instance of their subject and found nothing: misdirected-reply, orphan-reply, conditional-reply, unreturned-call,deadlock, after-destroy, before-create, double-create, double-destroy, guard-overlap, guard-incomplete, activation-claim, unused-participant,undeclared-lifeline, duplicate-id, fragment-unclosed.

Make it your own.

sequence "Settlement fan-out"

participant Saga     "Settlement saga"
participant Ledger   "Ledger"
participant Notifier "Notifier"
queue       Events   "Event bus"  concurrent

par
  branch "debit"
    Saga   -> Ledger   : debit(4200)
    Ledger reply Saga  : posted
    Saga   async Events: debited
  branch "fee"
    Saga   -> Ledger   : debit(35)
    Ledger reply Saga  : posted
    Saga   async Events: fee.posted
end

Saga async Notifier : settled