Task service after a user task doesn't populate JOB_EXECUTION_FAILURE event

Hi,
My workflow is pretty simple, for example

  1. a Java service task A
  2. a user task
  3. another Java service task B

I want to add a global event listener to collect JOB_EXECUTION_FAILURE jobs for the alerting.
Then I tried to throw exception in the JavaDelegate.
The result is that

  1. the custom FlowableEventListener can catch the JOB_EXECUTION_FAILURE event if task A fails.
  2. only ENGINE_CLOSED event is received if task B fails.

Debugging result shows the formal dispatches the error event through DefaultAsyncRunnableExecutionExceptionHandler, but I can’t find the right place for the latter.

Any idea? Thanks!

BTW, the only difference between the workflow demo and my real workflow is that my real workflow put user task and service B inside an independent sub process and called in the main process.

I found a solution is that put flowable:async="true to service task B.

Another potential bug is JobEntity#getRetries() is not thread safety.
Normally it will return 1, 2, 3 by default, but always 1, 2, 2, 1, 3, 3…

Can you explain what you mean with this? The async executor guarantees that each job is executed by one thread only, at any time.

Hey Joram,
I require to print the failed task and its retired times. By default, the abnormal task will retry three times. So I expect to get log:

  1. task A, retry 1
  2. task A, retry 2
  3. task A, retry 3
    I got the job and its retries by
JobEntity entity = (JobEntity) commonEngineEvent.getEntity();
entity.getRetries()

But the retired number is always 1, 2,2 or 1, 1, 2…