How to end a participant's line in PlantUML sequence diagram
Asked Answered
S

3

8

Is there a way to end a participant's line in a sequence diagram before the end of the diagram? For example if I want to display how database stored procedures call each other:

@startuml
participant SP0
SP0 -> SP0 : Do minor stuff
create participant SP2
SP0 -> SP2 : Exec SP2
SP2 -> SP2 : Insert into table Tbl
SP2 -> SP2 : Do other stuff
SP2 -> SP0
SP0 -> SP0 : Do minor stuff
@enduml

enter image description here

I would like to terminate SP2's line as soon as it returns processing to SP0. Furthermore, if I later call a complicated procedure SP3 from SP0, I would like to place it on the same level vertically as SP2.

I can remove the footer with hide footbox but the line still stays there. Also activate and destroy don't end the line.

Thanks!

Sufferable answered 8/7, 2016 at 12:56 Comment(2)
I know this is old, but have you figured something out?Larentia
Heh. I think I didn't.Sufferable
H
2

I became a huge fan on PlantUML recently. As far as I can tell, one of the first diagrams that was supported was the Sequence Diagram. The strange thing here is that precisely this diagram is not conform the UML standards. The life line of an object starts when it is created, but it does not end after its destruction.

As a C++ developer, I sometimes make the joke that PlantUML as Java application waits for the Garbage Collector?

This image shows the usual visualization of a destroy.
(Image copied from https://creately.com/blog/diagrams/sequence-diagram-tutorial/)

Hyatt answered 28/6, 2022 at 6:25 Comment(0)
M
1

This option is not available on the sequence help. I suppose you have to have SP3 on the right side. A trick to shorten with the diagram's width is to add line breaks \n on long messages or notes.

Marmite answered 9/7, 2016 at 0:15 Comment(4)
Thanks for the input. Width is not the issue here. The issue is more about the diagram giving the impression that the stored procedure somehow continues as long as SP0 continues.Sufferable
@lauri could you be more specific about which SP continues? If you meant SP0, you could use activate SP0 Marmite
Let's rephrase that: The issue is more about the diagram giving the impression that the stored procedure SP2 somehow continues as long as SP0 continuesSufferable
Although you apparently can't end the SP2 dotted line, you could convey the message with destroy SP2. On this example, it's clear IMHO that C doesn't continue after WorkDone.Marmite
T
-1

You can use activate and deactivate for better understanding If you want to make readers understand that your participants are no longer alive after certain tasks, you can also use destroy. Find the example,

@startuml
actor User
participant "Class1" as A
participant "Class2" as B
participant "Class3" as C

User -> A: DoWork
activate A

A -> B: Create Request
activate B

B -> C: DoWork
activate C
C --> B: WorkDone
destroy C

B --> A: Request Created
deactivate B

A --> User: Done
deactivate A
@enduml

Output: enter image description here

Tribade answered 7/2, 2019 at 11:17 Comment(1)
My question was specifically about ending the lines and I said destroy and activate won't do it.Sufferable

© 2022 - 2025 — McMap. All rights reserved.