我应该如何停止长时间运行的 WF4 工作流程?
我正在开发一些 Workflow 4 活动,这些活动将不断循环并完成一些工作。例如,人们可以观看 RSS 源并在添加新项目时执行一些步骤。我希望能够干净地停止并重新启动此过程(即在 Windows 服务或 Azure 辅助角色中)。目前,我有一个 While 循环,其表达式始终解析为 true,并在应用程序关闭时让实例终止。但这似乎不是一个非常干净的停止工作流程的方法。
我应该如何停止和重新启动工作流程?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确切的系统有点取决于您托管工作流程的方式,但我假设您正在使用 WorkflowApplication。在这种情况下,简单的选择是使用 WorkflowApplication,它具有 Cancel 方法,您可以使用它来取消工作流的执行。您还可以创建添加书签的活动并恢复停止书签或类似的操作,但这可能有点过头了。
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.