cancel
Showing results for 
Search instead for 
Did you mean: 

Receive Task - Error Handling

cpiepel
Champ in-the-making
Champ in-the-making
hi folks,

we would do some kind of error handling in our process.
We have a sequence of service task, that does some async stuff (send a jms message), then we have a receive task that waits for answer of the async. service call.
If the service call is successful we complete the receive task.
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processId).activityId(receiveActivityId).singleResult();
runtimeService.signal(execution.getId(), processVariablesMap);

After that we have some more service task –> receive Task sequences.

But if the async. call does not succeed we get a message and then we want to do something like
runtimeService.signal(execution.getId(),    BPMNError("code","message"));

How can we do that an is is possible to register Errorhandler to the process ?

Upload process image will currently not work (Could not upload attachment to ./files/3577_3c5a6eea8a66832846c8c6dab4a522ac.)

Thanks for help.
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
It's not possible to throw en error from outside a BPMN process. However, you could wrap all of your current service-receive task sequences in a single embedded subprocess, and add a signal-boundary event to the subprocess, with a unique signalName (e.g.. asyncFailedSignal) that cancels the running subprocess and takes an alternative path.

cpiepel
Champ in-the-making
Champ in-the-making
Thanks for your reply. After some trouble with the designer it works now.