Task send message

For an overview of tasks please see: Task: overview.

Task send message sequence

There are two mechanisms provided for sending messages between tasks:
  • SendMessage() - synchronous message send
  • QueueMessage() - asynchronous message send

Synchronous SendMessage()

SendMessage() sends a message along a specified connection to the task at the other end of the connection using a synchronous call (i.e. the calling thread is blocked until the message has been received and processed).

mtf-runtime-task-sendmsg.png

To send a message synchronously the following steps are followed:
  1. The target task is discovered by finding the parent task of the opposite connection point
  2. The target task's ProcessEvent() method is invoked to handle the incoming event
  3. This extracts the message and calls OnMessage(), which is overridden in a deriving class to provide specific message handling functionality

Asynchronous QueueMessage()

QueueMessage() sends a message along a specified connection to the task at the other end of the connection using an asynchronous invocation (i.e. the calling thread is not blocked and the message is received and processed asynchronously in another thread).

mtf-runtime-task-queuemsg.png

To send a message asynchronously the following steps are followed:
  1. The AsyncActionMsg() method is queued to run on the next available worker and control is returned to the sending task while the following processing occurs simultaneously:
  2. The target task is discovered by finding the parent task of the opposite connection point
  3. The target task's ProcessEvent() method is invoked to handle the incoming event
  4. This extracts the message and calls OnMessage(), which is overridden in a deriving class to provide specific message handling functionality

Last edited Aug 30, 2012 at 10:07 AM by jaorme, version 10

Comments

No comments yet.