Expiring global units of work
The queue manager can be configured to expire global units of work after a pre-configured interval of inactivity.
To enable this behavior, set the following environment variables:- AMQ_TRANSACTION_EXPIRY_RESCAN=rescan interval in milliseconds
- AMQ_XA_TRANSACTION_EXPIRY=timeout interval in milliseconds
Attention: The environment variables only affect transactions that are in Idle state in table 6-4 of the XA Specification from The OPEN Group.
That is, transactions that are not associated on any application thread, but for which the external Transaction Manager software has not yet called the xa_prepare function call.
External transaction managers keep only a log of transactions that are prepared, committed, or rolled back. If the external transaction manager goes down for any reason, on its return it drives prepared, committed, and rolled back transactions to completion but any active transactions that have yet to be prepared become orphaned. To avoid this, set the AMQ_XA_TRANSACTION_EXPIRY to allow for the expected interval between an application making MQI transactional API calls and completing the transaction, having carried out transactional work on other resource managers.
To ensure a timely cleanup after the AMQ_XA_TRANSACTION_EXPIRY expires, set the AMQ_TRANSACTION_EXPIRY_RESCAN value to a lower value than the AMQ_XA_TRANSACTION_EXPIRY interval, ideally so that the rescan occurs more than once within the AMQ_XA_TRANSACTION_EXPIRY interval.
Parent topic: Transactional support scenarios