Support Article
Case creation agent navigates to the broken queue
SA-88789
Summary
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.
Error Messages
Not Applicable
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.
Root Cause
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.
Resolution
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.
Published February 11, 2020 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.