Expired messages on z/OS
On IBM MQ for z/OSĀ®, messages that have expired are discarded by the next appropriate MQGET call.
However, if no such call occurs, the expired message is not discarded, and, for some queues, a large number of expired messages can accumulate. To remedy this, set the queue manager to scan queues periodically and discard expired messages on one or more queues in one of the following ways:
- Periodic scan
- We can specify a period using the EXPRYINT (expiry interval) queue manager attribute. Each time the expiry interval is reached, the queue manager looks for candidate queues that are worth scanning to discard expired messages.
The queue manager maintains information about the expired messages on each queue, and knows whether a scan for expired messages is worthwhile. So, only a selection of queues is scanned at any time.
Shared queues are scanned by only one queue manager in a queue sharing group. Generally, it is the first queue manager to restart, or the first to have EXPRYINT set. If this queue manager terminates, another queue manager in the queue sharing group takes over the queue scanning. Set the expiry interval value for all queue managers within a queue sharing group to the same value.
Note that expiry processing takes place for every queue when a queue manager restarts, regardless of the EXPRYINT setting.
- Explicit request
- Issue the REFRESH QMGR TYPE(EXPIRY) command, specifying the queue or queues that you want scanned.