Sequence diagrams: self-call messages
简介 / Introduction
When an object calls one of its own methods while handling a request, the sequence diagram shows a message going from a lifeline back to itself — a “self message”. Both engines support this, but they place the loop slightly differently: PlantUML draws the loop on the right side of the lifeline, Mermaid draws it on the left. This article compares the two notations with the same retry scenario.
PlantUML 版
1 | @startuml |
In PlantUML, pointing both ends of an arrow at the same participant creates a self message: Order -> Order: message. The loop is drawn on the right of the lifeline by default, and multiple self calls on the same participant stack to the right one after another.
Mermaid 版
1 | sequenceDiagram |
In Mermaid, point an arrow (->> for solid or -->> for dashed) at the participant itself, e.g. Order->>Order: retryOrder(). Mermaid draws the self-call loop on the left of the lifeline; switching between solid and dashed is just a matter of changing the arrow symbol.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Self-call syntax | Order -> Order: message |
Order->>Order: message |
| Loop side | right of the lifeline | left of the lifeline |
| Arrow variants | -> solid, --> dashed |
->> solid, -->> dashed |
| Multiple self calls | stack to the right | stack to the left |
| Activation state | pair with activate / deactivate |
pair with activate / deactivate |
小结 / Wrap-up
Self messages are nearly identical in the two engines: point the arrow at the same participant on both ends. The real differences are the dashed-arrow symbol (PlantUML uses -->, Mermaid uses -->>) and which side of the lifeline the loop appears on. Wrapping self calls in activate / deactivate makes it clear that the object re-enters its own logic while it is still busy.
- Title: Sequence diagrams: self-call messages
- Author: puml.online
- Created at : 2026-11-25 01:00:00
- Updated at : 2026-11-26 01:07:01
- Link: https://puml.online/blog/sequence-diagram-self-message-en/
- License: This work is licensed under CC BY-NC-SA 4.0.