Can lifeline activations be labeled?

0 votes
asked Jun 21, 2018 in Question / help by zooce (140 points)
I'm trying to do something like the following, but it doesn't look right. I'm guessing I need to somehow label the lifelines to end them appropriately. Is it possible to do so?

@startuml
R1 -[#blue]> Q : Add [R1]
activate Q #blue
Q -[#blue]> Q : Do some stuff [R1]
R2 -[#orange]> Q : Add [R2]
activate Q #orange
R1 <-[#blue]- Q : done [R1]
deactivate Q
Q -[#orange]> Q : Do some stuff [R2]
R2 <-[#orange]- Q : done [R2]
deactivate Q
@enduml

1 Answer

0 votes
answered Jul 18, 2018 by andreas.kagedal (300 points)
This is perhaps not the answer you want, but if you want to show that there can be independent "request signals" from R1 and R2 and they are handled in parallell, you and use a par-box:

http://www.plantuml.com/plantuml/uml/NP1D2iCW48NtSug1hhE8on9A2hs0RaCMqpef0QF5dvw_6WabxiJvvfl76qCa7zDcu4CUL8_TT7cQnFCD9LxnhZLEgf-1Nd7zKkJykyz1DkJ3ON0ROuXfMUfEjWq7rEsGTfRhJFFV26m2WnB5w3pPz_cwE5-l1CY6RXEKlU8S3gp98DeCLcEfOCoFKiSF

@startuml
par
R1 -[#blue]> Q : Add [R1]
activate Q #blue
Q -[#blue]> Q : Do some stuff [R1]
R1 <-[#blue]- Q : done [R1]
deactivate Q
else
R2 -[#orange]> Q : Add [R2]
activate Q #orange
Q -[#orange]> Q : Do some stuff [R2]
R2 <-[#orange]- Q : done [R2]
deactivate Q
end par
@enduml
commented Jul 20, 2018 by zooce (140 points)
Thanks for the reply! I do know about the `par` construct, but I was looking for something with a better visual representation of time - I want to see these processes side by side.
...