I have a process instance which should fail on a technical error so that I can handle it sometime later using the failed jobs section in the Cockpit.
But how to make a job fail within a ServiceTask (with async before and marked as exclusive)? Is it ok to throw any Java exception except for the class
Furthermore: Is it possible to make a technical error visible to a user task which has been executed one step before the failed service task?
Yes, you can throw any exception. In the Java API, the methods
ManagementService#getJobExceptionStacktrace are going to provide you with the exception details afterwards and Cockpit visualizes them as well.
As for your second point, what exactly do you mean? As far as I know, the incident is visualized in Cockpit on that BPMN element that is declared
asyncAfter. If the user task is
asyncAfter and the following service task is not asynchronous, the failed job badge should show up on the user task.
Alright, thank you!
You got my second question right and solved my issue. So the way the engine handles technical exceptions is straightforward for Java developers which makes errors fun again