Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Elements of sequence diagrams

ElementSyntax
Lifelineparticipant, actor
Messagea -> b, a ->> b, a --> b, [-> a, a ->]
Executiona -> b : call { ... }, return
Creation and destructiona -> new "B" as b, create, destroy
Combined fragmentalt, opt, loop, break, critical, neg, par
Interaction useref over a, b : Name
Notenote over a: text
diagram sequence "All the sequence elements"

actor User as u
participant Server as s

u -> s : request() {
  opt "cached" {
    return hit
  }
  s -> new "Worker" as w : start
  destroy w
  return result
}
note over s: Stateless.
All the sequence elements opt [cached] User Server Worker Stateless. request() hit start result

See Sequence diagrams for how to write one.