parasrish
parasrish

Reputation: 4152

Sequence Diagram : Thread processing over messages in queue

As understood from the Sequence-Diagram symbols, the sync-calls and async-calls have "solid line with solid head" and "solid line with thin head" respectively.

Consider the case, as;

  1. Some Notification, does add a message in queue (now this async thread dies here).
  2. There is already a processor-thread, for the queue, which checks on the queue-empty state, and proceeds with the processing of the messages in the queue, one after the other (this thread is looping over the queue.empty() check, to process the messages)

Now, the concern is;

  1. For the 1st point, how to represent the "platform notification" on the sequence diagram, as its like an event? [I have been using "dotted line" with "event name" so far, but as read from the UML specifics "dotted lines" are generally used for the returns]
  2. For the 2nd point, how to show case the "processor-thread operation" different from the first thread?. As, the sequence of the message-processing from the queue is not triggered in sequence of the message-added-to-the-queue (but the sequence is asynchronously followed).

Upvotes: 2

Views: 5709

Answers (1)

www.admiraalit.nl
www.admiraalit.nl

Reputation: 6089

  1. Use a solid line with an open arrowhead.

  2. Show the processor thread as a separate lifeline. Do not show the queue as a lifeline, since it is just a means to implement the asynchronous messaging. I would model it like this:

async example1

If it's important to show that the processing happens later than the moment the message is sent, you could leave some vertical space (idle time) between the open arrowhead and the processing, as follows:

async processing with delay

If you really want to show the queuing and polling mechanism, you can do it as follows, but note that all messages are synchronous now.

async implemented using sync messages

Upvotes: 6

Related Questions