在故障处理程序中挂起工作流实例

发布于 2024-08-13 01:23:05 字数 578 浏览 4 评论 0原文

我想在我的工作流程中实现一个解决方案,该解决方案将执行以下操作:

在工作流程级别中,我想实现一个故障处理程序,它将因任何异常而暂停工作流程。

然后在某个时候实例将收到 Resume() 命令。

我想要实现的是,当收到 Resume() 命令时,实例将再次执行之前失败(并导致异常)的活动,然后继续执行他必须执行的任何操作。

我的问题是什么:

  1. 当在故障处理程序中暂停然后恢复时,实例刚刚完成。恢复当然不会使实例返回执行, 因为在故障处理程序中,在挂起活动之后 - 我什么都没有。所以 显然,工作流的执行到此结束。

  2. 我确实希望在工作流级别实现错误处理程序,而不是使用 While+Sequence 活动来包装工作流中的每个活动(如下所述: 工作流程中的错误处理 )因为我的工作流程相当繁重 - 这将看起来像地狱。 它应该是一种通用处理..

你有什么想法吗?

谢谢 。

I want to implement a solution in my workflows that will do the following :

In the workflow level I want to implement a Fault Handler that will suspend the workflow for any exception.

Then at sometime the instance will get a Resume() command .

What I want to implement that when the Resume() command received , the instance will execute again the activity that failed earlier ( and caused the exception ) and then continue to execute whatever he has to do .

What is my problem :

  1. When suspended and then resumed inside the Fault Handler , the instance is just completes. The resume of course doesn't make the instance to return back to the execution,
    since that in the Fault Handler , after the Suspend activity - I have nothing. So
    obviously the execution of the workflow ends there.

  2. I DO want to implement the Fault Handler in the workflow level and not to use a While+Sequence activity to wrap each activity in the workflow ( like described here:
    Error Handling In Workflows ) since with my pretty heavy workflows - this will look like a hell.
    It should be kinda generic handling..

Do you have any ideas ??

Thanks .

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

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

发布评论

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

评论(2

夜空下最亮的亮点 2024-08-20 01:23:05

如果您正在使用状态机工作流程,我处理需要人工干预才能修复的错误的技术是创建一个额外的“stateactivity”节点来指示“错误”状态,例如 STATE_FAULTED。然后,每个状态都有一个故障处理程序,用于捕获任何异常、记录异常并将状态更改为 STATE_FAULTED,传递当前活动、引发的异常类型以及您可能需要的任何其他上下文信息等信息。

在 STATE_FAULTED 初始化中,您可以监听外部命令(您的 Resume() 命令,或任何适合您需要的命令),当一切正常时,您可以切换到之前的状态并恢复执行。

If you're working on State Machine Workflows, my technique for dealing with errors that require human intervention to fix is creating an additional 'stateactivity' node that indicates an 'error' state, something like STATE_FAULTED. Then every state has a faulthandler that catches any exception, logs the exception and changes state to STATE_FAULTED, passing information like current activity, type of exception raised and any other context info you might need.

In the STATE_FAULTED initialization you can listen for an external command (your Resume() command, or whatever suits your needs), and when everything is OK you can just switch to the previous state and resume execution.

蒲公英的约定 2024-08-20 01:23:05

恐怕这行不通。工作流中的错误处理类似于 Try/Catch 块,重试的唯一方法是将所有内容包装为一个循环,如果出现错误,则再次执行循环。

根据您尝试处理的错误类型,您也许可以通过创建自定义活动来实现您的目标,这些活动将自己的执行逻辑包装在 Try/Catch 中并包含所需的重试逻辑。

I am afraid that isn't going to work. Error handling in a workflow is similar to a Try/Catch block and the only way to retry is to wrap everything is a loop and just execute the loop again if something was wrong.

Depending on the sort of error you are trying to deal with you might be able to achieve your goal by creating custom activities that wrap their own execution logic in a Try/Catch and contain the required retry logic.

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