flowable / flowable-engine

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.
https://www.flowable.org
Apache License 2.0
7.82k stars 2.59k forks source link

Event JOB_EXECUTION_SUCCESS name is misleading #3500

Open thomasulllrich opened 1 year ago

thomasulllrich commented 1 year ago

Hi Tijs,

this is based on our last conversation which I can't reopen. As it seems to me after your explanation this event is not reflecting the success of the job execution. It is reflecting the successful planning of the job and afterwards potentially the JOB_EXECUTION_SUCCES happens. IF my understanding of this is right shouldn't the JOB_EXECUTION_SUCCES raised later and at the current location another event should be raised?

BR, Thomas

tijsrademakers commented 1 year ago

Hi Thomas,

When an async job is executed, the transaction can span multiple elements in the BPMN process model until the next wait state is reached. The event is currently thrown when the job could be executed and the first next step in the BPMN process model could be scheduled in the agenda of the process engine. From there, there could be several other service tasks that are executed until the transaction is full done and the job is deleted from the database. When executing the next service tasks, the engine doesn't even know anymore if it was started from an async job or not. Of course this can be implemented in a thread local or something, so that this can be determined. But then the event name should be something like JOB_EXECUTION_TRANSACTION_COMMITTED or something.

Best regards

thomasulllrich commented 1 year ago

Hi Tijs,

hope I get it right. For me it sounds like that the current JOB_EXECUTION_SUCCES is representing something else as it is used for right now and it should be raised when the job execution is really successfully finished. Is this right?

BR, Thomas