locked
Help with Correlating Messaging in WCF Windows Workflow (WF) Service RRS feed

  • General discussion

  • Hello There,

    I am writing a WCF workflow service that is actually targeting the .NET Framework 4 Platform Update 1, and I need some help understanding how to accomplish what I need to accomplish which I believe will involve using correlations.

    My (loooooong running) WCF service will start off receiving a list of tasks, already in sequential order which I will simply process with a ForEach activity. No Problem!

    Here is where I get unclear. For each one of these tasks (which of course has it's own ID), I will need to request for a user's input (which will likely be done using an InvokeMethod Activity to send an email and save some info to the database, to be responded to by the user in a different application) and only continue on with things (i.e. onto the next task) when I receive (Receive Activity) a request from a client for that same task. 

    My question is, is it possible to initialise a correlation for every task that gets processed and configure the receive port to only accept requests with that same task ID? I assume that this is standard Windows Workflow stuff but I am a bit new to it, and would appreciate anyone's input on how to achieve this.

    Thanks a lot!

    Kevin Parkinson

    Edmonton, AB Canada


    Kevin A Parkinson
    Monday, September 5, 2011 5:56 PM

All replies

  • Hi Kevin,
    You can use an InitializeCorrelation activity (which I think fits your scenario with InvokeMethod) to initialize a custom correlations with data that incoming messages must contain. Next in the sequence, you can use Receive activity to await arrival of a message with the matching data (only). You need to use a single CorrelationHandle variable shared in both activities to 'link them up'. Doing some searching for 'Correlation WF4' should find you a bunch of references.
    Tim


    Tuesday, September 6, 2011 5:02 AM
  • If a message comes in to that service that is not correlated to that instance, it won't be received. If you are using ForEach, then the tasks will be done in a sequential fashion, and the next email won't go out until the previous task is complete. Here is some more information on Correlation:

    http://msdn.microsoft.com/en-us/library/dd456784.aspx

    I am not sure if we have any sample code that matches up with your scenario but take a look and if you have any more questions please reply back or start a new thread, and we can help with some sample code.

    Thanks,

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

    Tuesday, September 6, 2011 10:10 PM
  • Thanks a lot, Gentlemen!

    I was hoping that would be the way it works.

    I will do some testing here and make sure to post my solution when I am done.

    Sincerely,

    Kevin Parkinson

     


    Kevin A Parkinson
    Tuesday, September 6, 2011 10:17 PM