views:

161

answers:

1

In developing a custom workflow that will execute numerous work items, it is possible that one or more workitems could fail at any time during their routines and even perhaps raise exceptions.

What is best practice when it comes to handling exceptions raised by workitems inside a workflow manager?

For instance, should the workflow management system simply just log the error and then die outright? Should the workflow manager simply log the exception and carry on with execution of other workitems?

+1  A: 

I would say that this is very context dependent.

Pack parcel

Dispatch parcel

Surely a failure of step 1 must not be followed by execution of step 2?

Check price with vendor A
Check price with vendor B
...
Check price with vendor Z

Buy cheapest

Proabably a failure of a few of the price checks shouldn't prevent the overall completion.

I think you will need to enable at least

Park this for human intervention

and

Sorry your request could not be actioned.

But this gets very tricky. You may need to enable compensation (undoing previous work). For example Book Hotel, try to book flight - fails, hmm not enough just to abort we also need to unbook that hotel.

You may also need to enable

That failed, I'll retry a little later.
djna
I agree with your comments, however should the workflow fail if a *single* item failed execution?
Mike J
What do you mean by single item? Pack Parcel in my example above is my understanding of a single ite, and I think it shows that flow cannot complete?
djna
For example one could have many concurrent work flow items executing at the same time, there a single item would refer to only one instance running (perhaps) in parallel with other work items.
Mike J
Fractal problem then :-) Again this is contextual. I was watching masterchef last night. Maze restaurant, several parallel streams of chefs each producing one plate of food. If any stream produces a sub-standard dish it is thrown away ... and so are all the other dishes in production by the other streams!
djna