I’m currently working on a simple workflow which contains an error boundary event.
I’m trying to implement an event listener which listens on error boundary events fired.
My company is using Spring (Version: 5.3) in conjunction with Camunda (Version: 7.12).
My current Java class declaration looks like this:
@DependsOn("processEngine")
@Service
@CamundaSelector(type = ActivityTypes.BOUNDARY_ERROR)
@RequiredArgsConstructor
@Lazy(false)
public class GlobalErrorBoundaryEventListener implements ExecutionListener {
I already tried to use “TaskListener” instead of “ExecutionListener” and “ActivityTypes.BOUNDARY_CANCEL” instead of “ActivityTypes.BOUNDARY_ERROR”, but nothing works as expected.
We already use TaskListeners and ExecutionListeners in our software and it works great, so I’m pretty sure I’m just doing it wrong.
I don’t want to have to implement an execution listener and manually add it to every boundary event I want to listen on.
Like this:
We use this error boundary event pattern multiple times in our processes.
But we’ve only listened to user task events via “TaskListener” until now.
I want to listen globally if error boundary events are fired.
Thank you for this idea.
I hope this will help someone out there!
But actually I imagined a much more universal solution for my problem.
I cannot change every process my company uses. We’re talking about hundreds of processes, distributed to different customers.
So I want to be able to hook on to the (Java-side) listener interfaces.
Like this one that we use successfully.
It fires every time a user task is created:
@DependsOn("processEngine")
@CamundaSelector(type = "userTask", event = TaskListener.EVENTNAME_CREATE)
@Service
@RequiredArgsConstructor
@Lazy(false)
public class GlobalTaskCreateListener implements TaskListener {
Isn’t there a possibility to do this for different events in Camunda?
@Override
public void notify(DelegateTask delegateTask) {
if (TaskListener.EVENTNAME_COMPLETE.equals(delegateTask.getEventName())) {
// Do this
} else if (TaskListener.EVENTNAME_UPDATE.equals(delegateTask.getEventName())) {
// Do that
}
But I haven’t had this requirement since long time.