LINQ Message Query Correlation
Custom MessageQuery, Content-Based Correlation.
This sample shows how to extend from the MessageQuery base class for the purposes of correlation. The custom implementation, LinqMessageQuery, allows users to provide an XName to find within the message using XLinq. The data retrieved by the query is used to form the correlation key to dispatch messages to the appropriate workflow instance.
To set up, build, and run the sample
This sample exposes a workflow service using HTTP endpoints. To run this sample, proper URL ACLs must be added (see Configuring HTTP and HTTPS for details), either by running Visual Studio as Administrator or by executing the following command at an elevated prompt to add the appropriate ACLs. Ensure that your Domain and Username are substituted.
netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%
Once the URL ACLs are added, use the following steps.
Build the solution.
Set multiple start-up projects by right-clicking the solution and selecting Set Startup Projects. Add Service and Client (in that order) as multiple start-up projects.
Run the application. The client console shows a workflow sending an order and receiving the purchase order id and then subsequently confirming the order. The Service window will show the requests being processed.
The samples may already be installed on your machine. Check for the following (default) directory before continuing.
If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.