I have message task which is waiting for message notification from rest API and on same task I have configured Timer Boundary Event which triggers after 5 min to perform a business operation.
After 5 minute, when timer boundry event triggers and starts performing business operation. Exactly at same time if we receive message correlation for message task then this meesage correlation completes message task and progresses execution to next service task until it reaches to next waiting task. When it reaches to waiting task then we are getting OptimisticLockingException and execution gets rollback to message task. Now operation performed inside service task is non-transactional hence system remains in inconsistent state.
We want prevent this scenario by validating if any job execution is in-progress or not. If any job execution in progress then we will not correlate message. Once job execution completes only then we will allow to correlate a message, so we can avoid optimistic locking exception and system will not perform any non-transactional operations.
Please guide how to check status of any job execution whether its execution is started or not