I have a BPMN process with an “Error Boundary Event” Code= 1 and Message=“MAIN_FLOW_BUSINESS_ERROR” linked to a sub process; when throwing the exception from the java Code the sub process is not starting:
throw new BpmnError(“1”, “MAIN_FLOW_BUSINESS_ERROR”);
PS: I’m using org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:7.21.0
The class should implement any of the Camunda classes in order to be able to Throw org.camunda.bpm.engine.delegate.BpmnError? since when throwing the BpmnError it’s throwing “error occurred in message handler” related to spring framework, however throwing the org.camunda.bpm.engine.delegate.BpmnError in a class that implements JavaDelegate, the process will work successfully.
If there’s no wait state the listening error event may not be committed to the database to be picked up. when the error throw is activated.
I’d suggest adding a wait state at the beginning of the sub process and seeing how that affects the error
Try ticking the async before ticket box on the start event in the sub process. This will create a transaction boundary. More details can be found here.
In the Camunda 7 documentation; it’s mentioned that throwing BPMN error in listeners invoked outside of the normal flow (in my case message listener) will not be caught.
Please advice if this is the case and if yes can you provide a workaround?