Tuesday 21 February 2023

PlantUML: Specify incoming and outgoing messages in a sequence diagram

[-> A, [--> A : Specify incoming message to the participant A

A ->], A -->] : Specify outgoing message from the participant A

 

incomingOutgoingMsgs.txt

@startuml

[-> A: Input received
activate A

A -> A: transform the data
A -> A: Apply business logic

A ->] : Send the response to external device
deactivate A


[--> A: Input received
activate A

A -> A: transform the data
A -> A: Apply business logic

A -->] : Send the response to external device
deactivate A

@enduml

Above snippet generates below diagram.


 


 

Similarly, you can have following syntaxes too.

[o->
[o->o
[x->
[x<-
->o]
o->o]
->x]
<-]
x<-]

 

incomingOutgoingMsgs1.txt

@startuml

[o-> A: Input received
activate A

A -> A: transform the data
A -> A: Apply business logic

A o->o] : Send the response to external device
deactivate A


[x--> A: Input received
activate A

A -> A: transform the data
A -> A: Apply business logic

A x-->o] : Send the response to external device
deactivate A

@enduml

Above snippet generates below diagram.



 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment