Trigger Boundary Error Event

Hello, Flowable,

Can I “bind” an error boundary event to receiveTask. And if yes how should I trigger it? runtimeService.dispatchEvent(FlowableErrorEvent)? And if yes how should I instantiate FlowableErrorEvent if all I know are errorId and executionId?

Thanks in advance

You model it: add a boundary error event to the receive task and that’s it.
To trigger it, an error should be thrown - which won’t be possible through the receive task, you’d need a service task for that.

What the use case you’re trying to solve?

Hi, Joram
I have a Service task where I invoke an external service, then I have a Receive task waiting for the callback from the service. When callback arrives without any errors I want to proceed normally (by Sequence flow #1) to the next Activity (runtimeService.trigger(…)). On the mentioned Receive task I have a TimeoutBoundaryEvent from which Sequence flow #2 points to an ErrorProcessingActivity. That does the job, but I want more: When callback arrives with some error I want to proceed to the same ErrorProcessingActivity. And I thought that it would be reasonable to have an ErrorBoundaryEvent on the same Receive task and Sequence flow #3 pointing to the ErrorProcessingActivity…

If you have full control over your service task, you could do this by throwing a BpmnError. See the section ‘Throwing BPMN Errors’ here: https://flowable.org/docs/userguide/index.html#serviceTaskExceptionHandling