Kanahaiya
Kanahaiya

Reputation: 426

how to handle error or exception in jbpm workflow

I am developing one jbpm flow which looks like below-

start---->ServiceTask1---output-->ServiceTask2-----output--->ServiceTask3-->end

and want to log the exception or error if it occurs in any of the service task either 1, 2 or 3 (inside workitemhandler). But don't know how to handle exception or error in jbpm.

So,Is there any small working example or link which shows how to handle error or exception in jbpm workflow.(Plz don't suggest jbpm-examples link i have already visited there are lot of flows together so not able to get the clear pictures)

Thanks for your help in advance.

Upvotes: 2

Views: 2738

Answers (1)

kris_k
kris_k

Reputation: 341

This question was also posted on google groups In there, there was an answer and it was accepted.

Below one can find an extract from that post (with working links): "in general, you have two options:

  • include error handling within your work item handler define whatever is needed to handle exceptions
  • make use of error catch events (including event subprocess) to handle exceptions within your process definition.

First option is very close to regular programming practices as it requires you to handle exceptions on code level. usually good for handling technical exceptions rather than business logic errors. For business logic errors, better fit is with error catch events within process - either boundary error events attached to given service task or event subprocess with start error event that will deal with errors.

Here you can find an example of the second approach where we call web service endpoint and handle errors if any:

From my side I will add that, there is another good post regarding error handling in custom process nodes in here.

Moreover if someone follows jBPM latest features: "configurable error handling is introduced in version 7.1, that will be responsible for catching any technical errors thrown throughout the process engine execution (including task service)." More info in here.

Upvotes: 1

Related Questions