Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Out-of-Order Message Processing

.NET Framework 4.6 and 4.5

Workflow services may depend on messages being sent in a specific order. A workflow service contains one or more Receive activities and each Receive activity is expecting a specific message. Without particular transport delivery guarantees, messages sent by clients may be delayed and therefore delivered in an order the workflow service may not expect. Implementing a workflow service that does not require messages be sent in a specific order is normally done using a Parallel activity. For a more complicated application protocol, the workflow would become very complex very quickly. The out-of-order message processing feature in Windows Communication Foundation (WCF) allows you to create such a workflow without all of the complexity of nested Parallel activities. Out-of-order message processing is only supported on channels that support ReceiveContext such as the WCF MSMQ bindings.

Out-of-order message processing is enabled by setting the AllowBufferedReceive property to true on the WorkflowService. The following example shows how to set the AllowBufferedReceive property in code.

// Code: Opt-in to Buffered Receive processing...
WorkflowService service = new WorkflowService
    Body = workflow,
    AllowBufferedReceive = true

You can also apply the AllowBufferedReceive attribute to a workflow service in XAML as shown in the following example.

// Xaml: Opt-in to Buffered Receive processing...
<WorkflowService AllowBufferedReceive="True">
   <!—the actual children activities -->
© 2015 Microsoft