简体   繁体   中英

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

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

在此处输入图像描述

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!

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.

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: 在此处输入图像描述

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?

这张图片显示了破坏的通常可视化。
(Image copied from https://creately.com/blog/diagrams/sequence-diagram-tutorial/ )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM