Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A sequence diagram is an interaction diagram that shows how processes operate with one another and in what order.

Most developers would find the syntax fairly familiar. The following example demonstrates two basic syntax.

Code Block
A.method()
A->B: Event
Zenuml sequence macro
param2
uuide81b78c9-ceaf-4e5b-ab09-a87d597f857b

Participants

The participants can be defined implicitly as in the first example on this page. The participants are rendered in order of appearance in the diagram source text. Sometimes you might want to show the participants in a different order than how they appear in the first message. It is possible to specify the participant’s order of appearance by doing the following:

Code Block
B
A
A.method()
A->B: Event
Zenuml sequence macro
param2
uuida1abacc4-481c-4e4e-9e46-29e892a867ad
InfoIf you have put B and A in the same line, the result would be the same. However, it is recommended to put the in separate lines. We are working on solutions to decorate participant. Putting them in the same line might cause issues when that is implemented.

Stereotype

Status
colourBlue
titleDatacenter only

It is possible to add stereotypes to participants using << and >>.

Code Block
<<Callable>> B
<<Service>> A
A.method()
A->B: Event
Image Added

Messages

A message is shown as a line from the sender MessageEnd to the receiver MessageEnd.

Info

See Unified Modeling Language v2.5.1, section 17.4.4.1.

Message type

DSL

Line and arrowhead (Spec)

Asynchronous

A->B: Asynchronous message

solid line with open arrowhead

Synchronous

A.method()

filled arrowhead

Reply

reply = A.method(), or
reply = method()

dashed line with either an open or filled arrowhead
* ZenUML renderer use open arrowhead.

Object creation

new ClassName()

dashed line with an open arrowhead

Object deletion

Status
colourRed
titleNOT SUPPORTED YET

Must end in a DestructionOccurrenceSpecification

Lost

Status
colourRed
titleNOT SUPPORTED YET

A small black circle at the arrow end of the message

Found

Status
colourRed
titleNOT SUPPORTED YET

A small black cirle at the starting end of the message

Loops

The loop operand will be repeated a number of times. This is expressed by the notation:

Code Block
while(condition) {}
for(enumerator) {}
forEach(enumerator) {}

See the example below:

Code Block
loop("Every minute") {
  Alice->Bob: Great!
}
Zenuml sequence macro
param21
uuidb826eb57-3f43-44b0-a88d-c852034e9db7

Alt

The alt operand represents a choice of behavior. At most one of the operands will be chosen. This is expressed by the notions:

Code Block
if (condition1) {
  ...
} else if (condition2) {
  ...
} else {
  ...
}
Code Block
if (x) {
  A.m1()
} else if (y) {
  A.m2()
} else {
  A.m3()
}
Zenuml sequence macro
uuid2e636d8c-99a7-425a-aa12-a760a8632634
updatedAt2020-09-26T02:52:18Z
if (x) {
  A.m1()
} else if (y) {
  A.m2()
} else {
  A.m3()
}