Windows Workflow Foundation,异常和重试?
我有一个包含许多活动的连续工作流程。 其中一项活动需要访问我的付费 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能还想查看这篇关于自定义重试活动的博客文章:
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!
查看
FaultHandlerActivity
,用于处理FaultType
属性指定类型的异常。 有关 WF 中错误处理的一些链接:另一种方法是使用
Activity.HandleFault
方法,当在活动执行的上下文中引发异常时调用该方法。Take a look at the
FaultHandlerActivity
, which is used to handle an Exception of the type specified by theFaultType
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.