views:

611

answers:

2

Hi Folks,

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!

+2  A: 

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.

Panos
1) The link goes to google GREECE, so i had to change that to com.au (for myself :P) awesome link btw!2) Having a quick flick through those links, they don't explain how to RETRY in case an exception is thrown. Do you have any info on that?
Pure.Krome
The link goes to google.com now... I would propose to handle the retries inside your code and not try to implement with other activities. For example, you may expose a MaxRetries property in your activity and throw an exception only if the number is exceeded.
Panos
yar. i can put the try catch in a loop condition and throw an exception if the retries count exceeds. Sounds a bit rough - i was hoping there was an activity that already does this.
Pure.Krome
+3  A: 

Hey,

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!

Perhentian