Workflow Foundation 4 WorkflowServiceHost Message Correlation
I have 2 methods on a workflow service hosted in WorkflowServiceHost.
The first method is called and starts the regular workflow sequence - talking to other web services, database work etc but on some occassions will pause and persist to db (as-in the delay activity) and wait for some human action to take place before continuing.
I need my second method to be able to hook into this persisted workflow, change a local variable and then continuing processing.
I have looked at message based correlation in workflow but can only seem to find examples where some kind of infinite while loop keeps the workflow instance active so that the second ser开发者_StackOverflow社区vice method call can arrive whilst it's still running.
Because my workflow instance will be delayed/persisted, the second service call doesn't seem to get anywhere (I can't have an infinite while loop keeping the workflow instance active).
I hope this makes sense - cheers!
Did you try and run into any problems here? And if so what is happening or what errors are you seeing?
The reason I ask is this should just work. The WorkflowServiceHost receives the message, loads the workflow from the persistence store if needed and resumes the bookmark in the workflow (a Receive activity used bookmarks under the covers).
You would need to put your delay activity into a PickBranch along side your second Receive activity if you wanted the Receive to be able to ursurp the Delay finishing. As you've explained it now, the Delay activity is preventing the Workflow from progressing to the point where your Receive activity has actually registered its bookmark.
Make sure your second service call does not have CanCreateInstance set to true and correlation is configured correctly. As the other poster mentioned, this should work no problems.
精彩评论