I created a BPMN process, and it has one callActivity. The job of the callActivity (custom service task) is to send an email. I need to resolve recipients of the email, and I do this on the parent process, and then pass that resolved variable into my send email callActivity. To resolve recipients, I’ve implemented custom logic so that I can call a custom method to populate the recipients variable. This custom method is made available to the flowable engine runtime via the spring application context (as a Spring Bean - NOT a JavaDelegate). I use a Spring @configuration class to define a handful of singleton beans.
My custom logic is implemented in a bpmn.xml process document like so: see bottom screenshot.
Notice in the sourceExpression, my bean’s name is email and my custom method is called testBpmnError(). This method throws a BpmnError.
My overall goal here is to implement error handling so that when there are errors in my custom code, I can throw them as BpmnErrors, which can be handled in the bpmn processes via boundary events, and I can do something with those errors in my process.
The problem I am having is that when I throw a BpmnError from my custom logic, it comes back as a FlowableException (with root cause being my BpmnError), and the whole transaction rolls back and stops my process in its tracks. The boundary event does not catch the FlowableException.
Is anyone familiar with error handling exceptions in custom code? Ultimately, I want to propagate my errors and do things with them, not shut down my process and roll back the transaction.
I’m a Flowable newb, so I may be missing some foundational knowledge though I have been combing through docs. Here’s my full bpmn process document for reference:
