I am working on a system (B) that communicates with another system (C) and displays calculated values in a ongoing loop at a terminal (A). (A) asks (B) to report a variable x
. (B) does so without blocking, so that (B) can continue to deal with (C). Later, (A) asks (B) to also report the variable y
, which will served by (B) in the same manner.
For documentation, I need to create a UML sequence diagram (using plantuml
) describing the process. My trouble now is how to model it properly. The communication between (B) and (C) goes on even though the loop has not finished. But how do I model that correctly?
Here's option 1, just using a asynchronous reply in the loop:
@startuml
A ->> B: report x
loop
B -->> A: x
end loop
B -> C: foo
C --> B: bar
A ->> B: report y
loop
B -->> A: y
end loop
B -> C: qux
C --> B: baz
@enduml
Option 2 works with a condition that becomes true later in the process:
@startuml
A ->> B: report x
loop until reporting x ends
B -->> A: x
end loop
B -> C: foo
C --> B: bar
A ->> B: report y
loop until reporting y ends
B -->> A: y
end loop
B -> C: qux
C --> B: baz
B -->> A: end reporting x
B -->> A: end reporting y
@enduml
Option 2 is more explicit. But does any of the two options denote the process at hand correctly?