ProducerConsumer on message arrival

For an overview of the ProducerConsumer please see: ProducerConsumer: overview.

ProducerConsumer on message arrival sequence

The processing of a message received by the ProducerConsumer task is depicted in the following sequence diagram:


In handling a received message, the OnMessage() method performs the following activities:
  • Determine the message type and extract it to the correct type
  • Retrieve the element number from the message
  • Lock the task element that the message is intended for
  • Call the appropriate handler method to process the message for the specific task element
  • Unlock the task element

It is important to note that the task element remains locked for the duration of the message processing. Message processing should therefore execute as fast as possible to minimize contention and the intention is that only a small amount of state-change logic is processed by the handler and that longer tasks are scheduled to be processed asynchronously.

Last edited Sep 11, 2012 at 5:46 AM by jaorme, version 4


No comments yet.