Hi Rashmitha,
I think you were almost there with your research already.
You are quite right that messages can have an TTL (time-to-live) set using the MQMD.Expiry field.
When a message has a TTL set, the queue manager will automatically delete (aka expire) messages whose TTL has passed.
You can set the TTL of a message, either in the application directly, or though a queue attribute called CAPEXPRY (note - no letter 'i' in the name)
The queue attribute means that you can do this without modifying the application code.
To set a 30 minute TTL with the queue attribute you would use CAPEXPRY(18000) - i.e. this value is configured in 10ths of a second.
To set a 1 day TTL with the queue attribute you would use CAPEXPRY(864000)
In case it is not obvious, you cannot have both of these set on the same queue.
Also note that only new messages that are put into the queue after the change in CAPEXPRY make use of it.
Here is some extra reading material about CAPEXPRY
Cheers,
Morag
------------------------------
Morag Hughson
MQ Technical Education Specialist
MQGem Software Limited
Website:
https://www.mqgem.com------------------------------