# Inconsistent context of the JOB\_EXECUTION\_FAILURE event with and without asyncComplete flag

**URL:** <https://forum.flowable.org/t/inconsistent-context-of-the-job-execution-failure-event-with-and-without-asynccomplete-flag/9170>\
**Category:** Flowable Engine\
**Created:** [April 5, 2022, 4:45pm UTC](https://forum.flowable.org/t/inconsistent-context-of-the-job-execution-failure-event-with-and-without-asynccomplete-flag/9170 "2022-04-05T16:45:14Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![VasilTsimashchuk](https://avatars.discourse-cdn.com/v4/letter/v/ed655f/32.png) [@VasilTsimashchuk](https://forum.flowable.org/u/VasilTsimashchuk)\
**Post date:** [April 5, 2022, 4:45pm UTC](https://forum.flowable.org/t/inconsistent-context-of-the-job-execution-failure-event-with-and-without-asynccomplete-flag/9170/1 "2022-04-05T16:45:14Z")

</div>

Dear Flowable experts,

The Flowable Engine dispatches a `JOB_EXECUTION_FAILURE` event when an exception is thrown during the `EndExecutionOperation` of a process instance. The failing job is converted into a `DeadLetterJob`.

In our environment, a `CallActivity` is used to trigger (one or multiple) SubProcess instance(s). In addition to that, there is an event listener which handles failing subprocess instances.

We’ve discovered that the context of the `JOB_EXECUTION_FAILURE` event is set differently depending on the `asyncComplete` flag of the `CallActivity`:

- In case of `asyncComplete=false`, the `JOB_EXECUTION_FAILURE` event is triggered in the context of the subprocess execution, the DeadLetterJob belongs to the subprocess execution.
- In case of `asyncComplete=true`, the `JOB_EXECUTION_FAILURE` event is triggered in the context of the super process execution, the DeadLetterJob belongs to the super process execution.

Is it an intended behavior? If yes, why?

From our perspective, the `JOB_EXECUTION_FAILURE` event should always be dispatched in the context of the execution which caused the exception.  
Currently, this is the case for `CallActivity` triggered with `asyncComplete=false`, but not for `asyncComplete=true`.  
[The following PR](https://github.com/flowable/flowable-engine/pull/3264) adjusts the behaviour accordingly.

Thank you!

---

_[View the full topic](https://forum.flowable.org/t/inconsistent-context-of-the-job-execution-failure-event-with-and-without-asynccomplete-flag/9170)._
