Sequence diagrams: ...> delay notation

Sequence diagrams: ...> delay notation

puml.online

简介 / Introduction

Sequence diagrams often need to say “a lot of time passed here”: a request goes out and the answer arrives 30 minutes later, or two systems poll each other on an interval. PlantUML has a dedicated syntax for this — a lone ... line means “time has passed”, and you can attach text to it. Mermaid has no equivalent native syntax, so the usual workaround is a Note or a dotted message. This article compares both approaches with a payment-callback scenario.

PlantUML 版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@startuml
participant Client
participant "Payment Service" as Pay
participant "Bank Gateway" as Bank

Client -> Pay: 发起支付请求
activate Pay
Pay -> Bank: 请求扣款
Bank --> Pay: 收到扣款指令
...
...3 秒后...
Bank --> Pay: 扣款成功
deactivate Pay
Pay --> Client: 支付完成
@enduml

In PlantUML, a line containing only ... marks the passage of time; it is drawn as an ellipsis marker on the lifeline. Writing ...3 秒后... attaches that caption to the delay position. Delay markers can sit between any two messages, letting you split a synchronous exchange into a request-wait-response trio.

Do not write the delay as an arrow with participants, such as A ...> B. PlantUML sequence diagrams have no such arrow form and reject it with a Syntax Error. A delay is a point on the time axis, not a message transfer, so it takes no source and no target.

Mermaid 版

1
2
3
4
5
6
7
8
9
10
11
12
13
sequenceDiagram
participant Client
participant Pay as Payment Service
participant Bank as Bank Gateway

Client->>Pay: 发起支付请求
activate Pay
Pay->>Bank: 请求扣款
Bank-->>Pay: 收到扣款指令
Note over Pay,Bank: 等待 3 秒
Bank-->>Pay: 扣款成功
deactivate Pay
Pay-->>Client: 支付完成

Mermaid’s sequence diagram grammar has no ... delay marker — typing it produces a Parse error on line .... The equivalent is Note over Pay,Bank: 等待 3 秒, which pins a caption box above the lifelines of the two participants and visually separates the two message groups. Note over A,B spans two participants; Note over A anchors the box to A’s lifeline only.

If the wait should look more like an interaction without a reply, use a dotted message instead, for example Pay--)Bank: 等待 3 秒 (--) is a dotted line with a solid arrow head), representing a one-way notification with no return value.

对比 / Side-by-side

Feature PlantUML Mermaid
Native delay syntax ... / ...3 秒后... none; approximate with Note
Where the caption lands next to the ellipsis marker in a box pinned above one or two lifelines
Is an ellipsis marker drawn yes, on the lifeline no, only the caption box
Pure wait with no follow-up message a lone ... line must be expressed with Note
Scope control fixed on the time axis Note over A,B vs Note over A

小结 / Wrap-up

Delay is one of the easiest things to get wrong in a sequence diagram. PlantUML treats time as a first-class citizen: a lone ... line is the delay, and you can caption it directly. Mermaid hands time to annotations, and Note over on the lifeline is the idiomatic way to show a waiting period. Both express the same idea — cutting one long interaction along the time axis — but PlantUML leans on a “timeline” mental model while Mermaid leans on an “event stream” one. Worth noting that in neither engine does a delay stretch a lifeline on its own; the visual gap still has to be reinforced with the explicit activate / deactivate spans.

  • Title: Sequence diagrams: ...> delay notation
  • Author: puml.online
  • Created at : 2026-11-26 01:00:00
  • Updated at : 2026-11-26 01:07:01
  • Link: https://puml.online/blog/sequence-diagram-delay-en/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Sequence diagrams: ...> delay notation