Case creation agent navigates to the broken queue
A Message Queue (MQ) Listener creates a case and sends it to another listener for processing. Intermittently, data from the created case is missing. An error does not display or generated in the logs.
Steps to Reproduce
- Use the Queue- For-Agent method to queue an entry for the case creation agent.
- Configure the agent to run on a regular interval.
An issue in the custom application code or rules.
Although Pega manages most of the locking (and the database transaction itself) using Bean Managed Transaction (BMT), MQ listeners use the Container Managed Transaction (CMT). A major difference between the modes is that for CMT, the lock is released immediately upon receipt of the Commit request, before the actual commit. With the lock is released but the work object is not yet committed, another process can lock and receive a stale copy of the work object. Eventually overwriting the change that was in process.
Perform the following local-change:
- Do not use the option 'Release-on-commit' when opening the work object, if the MQ Listener uses CMT processing to perform the work .
- Manually release all the locks with an explicit call to WorkUnlock after the commit. If a call is made to an out-of-the-box routine which uses the 'Release-on-commit', add a Obj-Refresh-and-Lock step after that and leave the 'Release on commit" unchecked. The process must check if it actually obtained the lock since the same Race condition can occur and it fails to obtain the lock.
Even if the work object is already locked in the 'Release on commit' state, Obj-Refresh-and-Lock switches the Lock state to the 'Not release on commit' if the process leaves the box unchecked.
0% found this useful