From BPMN Error event on User Task - How to correlate to the current instance - #3 by kontrag I understand that you would like to throw a BPMN error from such a listener. @StephenOTT’s idea in this thread is as follows:
- Your websocket handler class detects an error condition
- Your class completes the task via
TaskService#completeTask
providing a process variableraiseError
- You have an execution listener on the activity’s
end
event that throwsBpmnError
whenever it sees theraiseError
variable - The process engine triggers the error boundary event
That way, the process engine calls the execution listener triggered via task completion. There is no way to tell the process engine to invoke a listener outside of process instance execution context, so what you ask for in the original post is not possible.
All that said, I believe the proposed solution does not work due to the following missing feature: https://app.camunda.com/jira/browse/CAM-5399. You could work around that by introducing a script or service task after the user task and throwing and catching the BpmnError there as follows:
Of course this means you will have to change your process model because of this rather technical concern.
Cheers,
Thorben