Supose that I have a flowchat with a receive, custom code activity and sendreply and the custom code activity throws an exceptions. How can I return to the receive activity?
Any ideas?
Supose that I have a flowchat with a receive, custom code activity and sendreply and the custom code activity throws an exceptions. How can I return to the receive activity?
Any ideas?
You could use the "While" activity as a means of retrying - should there be an exception.
The entire article with more details for this sample is here
I created a custom activity in a similar way of the article with wf4, its something like this:
public sealed class Retry : NativeActivity {
public Activity Body { get; set; }
protected override void Execute(NativeActivityContext context) {
context.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
}
void OnBodyCompleted(NativeActivityContext context, ActivityInstance instance) {
}
void OnBodyFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) {
faultContext.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
}
}
Thanks!