locked
How to use ReceiveAndSendReply in a Parallel activity? RRS feed

  • Question

  • Hi

    I have simple workflow. It starts with ReceiveAndSendReply  which has CanCreateInstance set to true. I use correlation for other ReceiveAndSendReplies in

    my workflow (based on some key). It works fine until I put ReceiveAndSendReply in a Parallel activity.

    I have put two ReceiveAndSendReply  each in a seperate branch in a parallel activity. These two have the same contract and operation definition (I need this)

    Now the question is how can we make WF to choose a specific ReceiveAndSendReply  based on data we pass (like user id) ?

    Does correlation has any thing for this?

    Monday, May 28, 2012 1:33 PM

Answers

All replies

  • Hi,

    With correlation, we can send multiple WCF messages to the same workflow instance. However, correlation can't be used to route request to different service, create different workflow instance.

    ->I have put two ReceiveAndSendReply  each in a seperate branch in a parallel activity. These two have the same contract and operation definition (I need this)

    ->Now the question is how can we make WF to choose a specific ReceiveAndSendReply  based on data we pass (like user id) ?

    In this scenario, it is not WF choose a ReceiveAndSendReply activity, it is which Receive we send message to. As they have the same endpoint, service contract and operation contract,  it wouldn't work. Why do you need this? If you need it perform parallel tasks, it can be achieved by generating multiple workflow service instance. Or you may use your own Receive and SendReply instead of the preconfigured ReceiveAndSendReply, in this way you'll be able to do additional tasks before send reply to client, it can be based on user id and etc.

    Hope this helps, thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 29, 2012 4:19 AM
  • Hi Leo

    I actually  use send and receive as a mechanism for waiting for user to call. In my workflow I have parallel jobs which should be done with different users. and by submission of user workflow can continue. If there was a event based communication mechanism I would use that but unfortunately WF4 don't have any thing in this area and bookmarks don't work for me as well (coz it does not return any thing like "operation was successful" or "Operation failed" or "Bookmark does not exists").

    So what I really want is a mechanism to have an activity wait until something (event , message, etc) comes from user and a mechanism to send a specific msg/event to a specific activity in case of parallel scenarios.

    do you thing its possible?

    Tuesday, May 29, 2012 9:58 AM
  • Hi,

    I think this is possible. Check this thread:

    http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b4b5ca27-ef97-4f37-9eac-ff2e9645c615

    Also, ResumeBookmark will return a BookmarkResumptionResult enumeration value to indicate the results of the bookmark resumption request. The possible return values are Success, NotReady, and NotFound.

    Bookmarks

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

    • Marked as answer by LeoTang Tuesday, June 5, 2012 2:17 AM
    Wednesday, May 30, 2012 9:29 AM