In a sequence diagram, can we send a message to a box?

0 votes
asked Jun 21, 2019 in Wanted features by PlantUML Fan

Hello.  I am making a sequence diagram with -say- 3 participants: outside, thread1, thread2.

thread1 and thread2 are entities that belong together in a box called process.  And outside can send messages to either thread1 or thread2, but it can also send a message to the process in general.

But, for illustrative purposes, I'd like to outside to send messages to the process containing inside1 and inside2:

@startuml

box process

    participant thread1

    participant thread2

end box

outside -> thread1 : Send task.

ouside ->process : shutdown

@enduml

Is this possible?  And if so, how would I do it?  Thanks.

1 Answer

0 votes
answered Jun 24, 2019 by ichi

Hi,
Are "thread1" and "thread2" objects instead of classes?
If so, draw an object diagram instead of a sequence diagram.
And object diagrams can handle packages like class diagrams.
Are you looking for a diagram like this?

@startuml
package process {
    Object thread1
    Object thread2
}
Object outside

outside -> thread1 : Send task.
outside ->process : shutdown
@enduml

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuIf8JCvEJ4zLA2ZAJqujBbQevb800l-ahDJa4eMIZABKn1H3J24Zhbekg41-QKbnPaeg5nUKeQ1h1zEdOAKGd9gNeb2IM9ojXoGFjGieNPnHMfAINvx7vG1K1tGE0000

Are you looking for a time series representation like a sequence diagram?

commented Jun 28, 2019 by mgrol (3,150 points)

Hi,

not really, you won't get a handle on the box which is 

you might fake it like this 

Which is a result of the following code:

@startuml
box "process"
participant process
    create thread1
process -> thread1
    create thread2
process -> thread2
end box
outside -> thread1 : Send task to thread 1

outside -> process : shutdown
@enduml

BR,

Michael

...