cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle exceptions in a tasklistner

ruedesilva
Champ in-the-making
Champ in-the-making
Hi,

The task listners that we have on a task execute business rules in our own application (i.e. thru EJBs). But if those fail or there are system failures/exceptions with the EJBs how to handle them? The notify method does not throw an exception (even if it did how would it affect the task even itself - i.e. create, assignment etc) Is the only possibility to just eat the exceptions and forget about it? Note that there would be no point in setting task/process variables at this point.

thanks,
Rue
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
What do you mean, the notify doesn't throw an exception? When a task is created or completed, the call initiating this action (eather taskService.complete or runtimeService.startPI or signal) will receive the exception when calling, after transaction is rolled back… So ALL stuff done to the process/task won't be comitted.

ruedesilva
Champ in-the-making
Champ in-the-making
Thanks. I will test this out from a tasklistner for "Assignment' event.

- Rue

ruedesilva
Champ in-the-making
Champ in-the-making
So I will throw a RuntimeException as the notify method  interface does not have a throws clause. Is that the understanding?

thanks,
Rue

frederikherema1
Star Contributor
Star Contributor
If something goos wrong while execution (running) your process, it makes sense you should throw RuntimeExceptions Smiley Wink