问题描述
这是在使用WorkflowApplication托管我们的工作流的情况下.
This is in the context of using WorkflowApplication to host our workflows.
我们有许多错误状态,这些错误状态本质上是瞬态的(Web服务网站已关闭,Web服务行为不正确,数据库超时等).我们希望能够恢复由于某些时候其中一个错误而失败的工作流 将来当瞬态问题得到纠正后.
We have a number of error states that are transient in nature (web service website is down, web service is behaving incorrectly, database timeout, etc). We'd like the ability to resume workflows that failed because of one of those errors at some point in the future when the transient problem has been corrected.
我的初步研究表明WorkflowApplication不支持此功能:OnUnhandledException没有"Suspend"值.或类似内容-只是中止,取消,终止. OnUnhandledException的文档说:
My initial research indicates that WorkflowApplication doesn't support this: OnUnhandledException doesn't have a value for "Suspend" or similar -- just Abort, Cancel, Terminate. The docs for OnUnhandledException say this:
"和" OnUnhandledException 和 WorkflowUnhandledExceptionBehavior 规定了工作流中未处理异常时的运行时行为.然而, WorkflowUnhandledExceptionBehavior 可以选择将暂挂的工作流保留在持久性存储中,而 OnUnhandledException 确实不是.这样做的原因是,挂起的工作流程会发生特定于主机的情况, 和 WorkflowApplication 不是.要实现此功能,请使用 WorkflowApplication ,创建一个风俗 PersistenceParticipant 具有这种行为."
"Both OnUnhandledException andWorkflowUnhandledExceptionBehavior dictate the behavior of the runtime when an exception is not handled in the workflow; however,WorkflowUnhandledExceptionBehavior has the option of leaving a suspended workflow in the persistence store, whileOnUnhandledException does not. The reason for this is that what happens to a suspended workflow is host-specific, and WorkflowApplication is not. To implement this functionality usingWorkflowApplication, create a customPersistenceParticipant that has this behavior."
我查看了PersistenceParticipant文档,但这并不是完全有用.
I've looked over the PersistenceParticipant documentation, but it's not exactly useful.
那么,这些问题:
1)这是处理在未处理的异常上挂起"的方法吗?在WorkflowApplication中?如果没有,那是什么?
1) Is this the way to go about handling "Suspend on unhandled exception" in a WorkflowApplication? If not, what is?
2)如果是,我该如何暂停/取消暂停失败的实例?
2) If it is, how would I suspend/unsuspend a failed instance?
推荐答案
如果持久性是通过书签完成的,则只需恢复书签即可.
If the persistence is done by bookmarks, you can simply resume the bookmark..
或者,如果您使用任何临时持久性存储,则可以调用WorkflowApplication.Load(workflowInstanceId)从上一个持久性存储点重新加载先前中止的工作流.
Or if you use any ad-hoc persist, then you can call WorkflowApplication.Load(workflowInstanceId) to reload a previous aborted workflow from its last persisted point.
这篇关于工作流程应用程序中央错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!