Inbound Messaging

 

Updated: July 16, 2012

Workflow Manager 1.0 enables workflows to subscribe for and receive messages, both for new instance creation as well as correlation to existing instances. These messages are one-way brokered messages that rely on the user providing a filter as part of the subscription which is used to match inbound messages that are delivered at the corresponding Scope (the Scope under which the workflow is hosted).

Inbound Messaging

Workflow definitions themselves can define an ActivationFilter. This filter is used to determine whether a new instance of that workflow needs to be created when a message is published at the Scope. An executing workflow instance can also define filters by using the Subscribe and ReceiveNotification activities. For more information on Subscribe and ReceiveNotification activities in Workflow Manager 1.0, please see Pub/Sub Activities.

Messages are published to the Scope using the Notifications endpoint, or by using the .NET Client API (WorkflowInstanceManager) to publish the notification message. A notification message consists of two parts:

  • Properties – these are a flat list of key-value pairs that can be used for filtering purposes.

  • Content – this is the content of the message. A Dictionary<string, object> should be provided in order to map to the InArguments of the workflow definition or to ReceiveNotification’s Content property (ReceiveParametersContent). The following code snippt demonstrates how to publish a message to a scope.

    // Create the WorkflowInstanceManager   
    WorkflowInstanceManager wim = new WorkflowInstanceManager(new Uri(RootScope + ScopeName));   
    // Publish New Order message   
    wim.PublishNotification(new WorkflowNotification()   
    {   
        Properties =   
        {   
            { "EventName", "New Order" }   
        },   
        Content = new Dictionary()   
        {   
            { "OrderId", Int32.Parse(orderid) },   
            { "Cost", Double.Parse(ordercost) }   
        }   
    });  
    

Note

Workflow Manager 1.0 does not currently support direct SOAP messaging, including two-way (request-response) communication.