问题
I have a workflow service that runs and performs a number of different operations (such as web service calls).
If one of these operations fails I call an error reporting web service to notify a seperate system that one of my workflow operations has failed. As the error could be something like the web service being down, I loop and retry this operation until it works.
There can be times though when the data I'm passing to this web service is faulty and it needs changing. So I need to be able to hook into this running (but delayed) workflow and change local workflow variables and then re-run the operation.
I've looked at message correlation in workflow 4.0 to achieve this but because the delay activity is active in my running workflow instance, any second service call doesn't do anything (it's like the delay activity is blocking any other requests).
I've tried setting 'CanCreateInstance' to both true and false but it doesn't help.
Thanks!
回答1:
You need to put the Delay activity inside a Parallel container, and also in that have the receive task. This means that it will be listening for requests while waiting for the loop to process.
For an example of how message correlation works I found the Tailspin Travel example very helpful. Check the "Receive Approval" task within the "Wait Confirmation" box to see how to tie the requests together.
回答2:
Not sure if this is the answer to you problems but it may just be. If you are using a workflow instance store and property promotion you have the option to change the properties in the instance store for next time the workflow is loaded.
来源:https://stackoverflow.com/questions/2592401/workflow-foundation-4-0-message-correlation-and-error-reporting