views:

13

answers:

1

I'm developing some Workflow 4 activities that will continuously loop and do some work. For example, one may watch an RSS feed and execute some steps as new items are added. I would like to be able to stop and restart this process cleanly (ie, in a windows service or Azure Worker Role). Currently, I have a While loop with an expression that always resolves to true, and just let the instance die when the app closes. But it seems like this is not a very clean way to stop the workflow.

How should I stop and restart the workflow?

A: 

The exact system depends a bit in the way you host your workflow but I am assuming you are using the WorkflowApplication. In that case simple option is to use the WorkflowApplication which has a Cancel method you can use to cancel execution of the workflow. You can also create a bookmarked activity and resume a stop bookmark or something similar but that might be overkill.

Maurice