External Task end listener called despite Timer Boundary event triggered

I have the situation where while an External Task gets executed a timer Boundary Event gets triggered. The unexpected thing is that the end listener for the External Task is called. I thought if such an interrupting Boundary Event gets triggered, the end listener wouldn’t be called.

What am I missing?

Thanks.

Hi @Esche,

The execution listener is triggered as soon as the task ends. It does not matter if the task is completed or interrupted at least I think that is the default behavior. So I think it works as expected.

If you want to trigger the listener just if the task is completed, the external task can create a variable which can be sent with the completion. The execution listener could then check for the variable and just in case the variable exist execute it’s logic.

I hope that helps
Nele

Hi @Nele ,

Thank you for your response. I tried out what you suggested, setting a process variable to true in the start execution listener of the External Task, executing the end execution listener only if that process variable is still true and then setting the process variable to false in case the boundary event listener gets executed.

But then I realized that the end execution listener is called before the boundary event listener. Of course, that makes this approach ineffective.

Would you have any other idea?

Thanks.

Hi @Esche,

You could set the variable to false in the start execution listener. The external task then sets the variable to true, if it completes. Then the end execution listener
would just be triggered if the external task has sent a complete call. I tried to draw what I mean in a BPMN model. Maybe that makes it more clear :slight_smile: externalTask-timeout-and-listener.bpmn (6.0 KB)
I hope that works now. Kind regards
Nele

Hi @Nele,

Yes, that worked. Thanks a lot for this; and for making it explicit.

I still have the issue of setting a process variable defined in a parent execution from the child execution. The process variable in the parent execution is used to determine whether the end listener is called or not. But setting the variable needs to happen in a child execution.

Would you know the solution for this too? Is this something trivial?

Thanks,
Esche

Hi @Esche ,

Is your child execution a call activity or a local scope execution (like a sub process)?

Cheers
Nele