Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PlantUML: overlapping activations (multiple threads)

Tags:

uml

plantuml

I am trying to show overlapping activations in my sequence diagram (I am using PlantUML) but they are showing as nested activations:

For example:

@startuml
participant T1
participant T2
participant Main

T1 -> Main ++ #red: start
T2 -> Main ++ #yellow: start

Main --> T1 -- #red : done
Main --> T2 -- #yellow : done

@enduml

This will show nested red/yellow activations while I was expecting red to finish before yellow.

Is this supported? Am I doing something wrong?

Thanks!

like image 278
Juan Leni Avatar asked May 06 '17 12:05

Juan Leni


1 Answers

If I understand the question properly, you are trying to show that Main can be actived in parallel. If so, you should use a par fragment to indicate parallel operations (see Parallel Fragment). This can be depicted as follows:

@startuml
participant T1
participant T2
participant Main

par
    T1 -> Main ++ #red: start
    Main --> T1 -- #red : done

    else

    T2 -> Main ++ #yellow: start
    Main --> T2 -- #yellow : done
end
@enduml

While the else keyword is generally used for an alt/else fragment, it can also be used in other group types to add a visual separator. The resulting diagram of the above, is shown below.

enter image description here

like image 117
Frelling Avatar answered Dec 31 '22 03:12

Frelling