Lifelines and bars
Create and end participants partway through a sequence diagram, and show when a participant is busy with activation bars.
A lifeline runs from a participant's head to the bottom of the diagram. In the code you can start it partway down, end it early, and mark when the participant is busy.
Create and destroy
Shop->Worker **: Archive order
Worker-->Shop: Archived
destroy Worker** after the receiver means the message creates it. Its head is drawn level with the message rather than at the top.
destroy on a line of its own ends a lifeline in a cross. Nothing below it is drawn on that participant.
The other tools' ways of saying the same work too:
A->*B: text, a star before the receiver, creates B, as in sequencediagram.org.create Bon a line of its own, as in PlantUML and Mermaid, means the next message to B creates it.create actor Bsays what it is as well.destroyafter Bends B's lifeline after the next message, anddeactivateafter Bends its bar there.destroysilent Bends the lifeline asdestroydoes.
Activation bars
Client->API ++: GET /orders/42
API->DB: Load order
DB-->API: Order
API-->Client --: 200 OK++after the receiver starts the receiver's bar.--after the receiver ends the sender's bar.- Both can go on one message:
++ --.
You can also start or end a bar on a line of its own, with activate App and deactivate App. Ending a bar on a participant that isn't active is a warning in the Problems panel.
Add bars for you
autoactivation on, or PlantUML's autoactivate on, adds the ++ and -- for you. From that line on, a message to another participant starts the receiver's bar, and a reply ends the sender's. autoactivation off stops it.
A message that fails or is lost never arrives, so it starts nothing.
Bars have no colour. A colour after activate or ++, such as ++ #lightblue, is read past.