在 WF 4 中实现 GoTo

发布于 2024-10-05 01:19:11 字数 678 浏览 8 评论 0原文

给定在 AppFabric 下部署的 SQL Server 持久 .NET 4 Windows Workflow Foundation (WF) 工作流服务,我如何将该服务从一个活动“跳转”到另一个活动?工作流程可以是顺序的或流程图的。

该用例是管理性的。长时间运行的工作流在接收活动 A 处处于空闲状态。某些客户端错误地调用该服务,将其进展到接收活动 B。该工作流(可以嵌入到更大的工作流中)没有返回到 A 的路径。客户端致电支持人员办公桌并请求将工作流程设置回 A。

我们已经看到这种情况在生产中经常发生。我们现有的 BPM 系统支持“goto”调用。在 WF 4 中如何实现这一点?

编辑:如果上述不切实际,那么什么是一个好的设计模式,用于从“快乐路径”实现“失败”活动,该活动可以分支到有限数量的已知先前活动之一(从这里重新启动)基于变量?目标是避免创建包含大量行的不可读的工作流程。

编辑2:我们决定不走这条路,但有一个更新的MSDN 文章 就是关于这样做的。

编辑 3: 我们再次改变了主意,并采用上面链接的 MSDN 文章中 Leon Welicki 的解决方案。 :)

Given a SQL Server-persisted .NET 4 Windows Workflow Foundation (WF) workflow service deployed under AppFabric, how can I "jump" the service from one activity to another? The workflow could be sequential or flowchart.

The use case is administrative. A long-running workflow is idle at Receive activity A. Some client mistakenly calls the service, progressing it to Receive activity B. The workflow (which could be embedded in a larger workflow) has no path back to A. The client calls the support desk and requests that the workflow be set back to A.

We've seen this case occur frequently in production. Our existing BPM system supports a "goto" call. How can this be accomplished in WF 4?

EDIT: If the above is not practical, what is a good design pattern for implementing a "fail" activity off from the "happy path" that can branch to one of a limited number of known prior activities (restart from here) based on a variable? The goal is to avoid creating an unreadable workflow with a multitude of lines.

EDIT 2: We decided not to go this route, but there's a newer MSDN article on doing just this.

EDIT 3: We changed our minds again and are going with Leon Welicki's solution from the MSDN article linked above. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

远昼 2024-10-12 01:19:12

这不能开箱即用。

如果可以做到这一点,则意味着打开工作流状态,存储在 4 个二进制列中,并将其更改为之前的状态,因为知道可以执行任意数量的活动,并且可以更改甚至删除任何变量,因为它们是不再在范围内。

假设我要尝试这个,我会尝试在每次工作流空闲时从 SQL 数据库复制状态,这样您就可以得到一种包含工作流之前所有空闲状态的堆栈。然后,稍后当工作流空闲且不在内存中时,您可以将当前状态替换为以前的状态并重新加载工作流。我从未尝试过,所以不知道它是否会起作用,并且看到了很多潜在的问题,比如数据库事务已完成或电子邮件已发送但第二次执行。

This can't be done out of the box.

If it can be done at all it would mean opening up the workflow state, stored in 4 binary columns and changing those to the previous state knowing that any number of activities could have executed and any variables could have been changed or even dropped because they are no longer in scope.

Suppose I was going to try this I would try copying the state from the SQL database every time a workflow went idle so you get a sort of stack with all previous idle states of a workflow. Then at some later time when the workflow is idle and not in memory you can replace the current state with a previous state and reload the workflow. I have never tried it so don't know if it will work and see quite a few potential problems, thinks like DB transaction having competed or emails having been send but executing a second time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文