Windows Workflow Foundation,异常和重试?

发布于 2024-07-08 20:48:29 字数 299 浏览 6 评论 0原文

我有一个包含许多活动的连续工作流程。 其中一项活动需要访问我的付费 S3 帐户。 它工作正常,但要小心,我想确保它可以处理意外情况,例如“找不到主机”或超时等。

所以..我通常会将代码放在 TRY / CATCH 中。 很好..但我不确定我应该如何处理工作流程..因为如果代码未能正确完成,则工作流程的其余部分不应发生(基于此工作流程的逻辑)。

因此,我想重试连接几次..如果最终失败,请调用电子邮件活动并终止工作流程。

任何人都可以提出任何建议、视频或屏幕链接来帮助展示最佳实践是什么?

干杯!

I have a sequential workflow with a number of Activities. One of these activities needs to access my paid S3 account. It works fine, but to be cautious, I would like to make sure it can handle unexpected situations, such as 'Host not found' or some timeout, etc.

So .. i would normally put the code inside a TRY / CATCH. That's fine .. but i'm not sure of what i should do with the workflow .. because if the code fails to complete correctly, the rest of the workflow shouldn't occur (based on the logic of this workflow).

So, i wanted to maybe retry the connect a few times .. and if that finally fails, call an Email Activity and terminate workflow.

Can anyone make any suggestions, links to vid's or screenies that help show what is the best practice for this?

cheers!

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

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

发布评论

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

评论(2

泪意 2024-07-15 20:48:29

您可能还想查看这篇关于自定义重试活动的博客文章:
http://www.pluralsight.com/ Community/blogs/matt/archive/2007/11/28/49315.aspx

看起来这正是您可能需要的!

You might also want to have a look at this blog article on a custom Retry activity:
http://www.pluralsight.com/community/blogs/matt/archive/2007/11/28/49315.aspx

Looks like it is just what you might need!

幻想少年梦 2024-07-15 20:48:29

查看 FaultHandlerActivity,用于处理 FaultType 属性指定类型的异常。 有关 WF 中错误处理的一些链接:

另一种方法是使用 Activity.HandleFault 方法,当在活动执行的上下文中引发异常时调用该方法。

Take a look at the FaultHandlerActivity, which is used to handle an Exception of the type specified by the FaultType property. Some links about error handling in WF:

Another way is to use the Activity.HandleFault method, which is called when an exception is raised within the context of the execution of your activity.

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