Author |
Message
|
Blobtastic |
Posted: Mon Nov 03, 2003 6:40 am Post subject: Making messages expire |
|
|
Apprentice
Joined: 03 Nov 2003 Posts: 34 Location: uk
|
I've looked through the message boards to find info about message expiry, and it seems that it is something that can be set (in the MQMD?) , but only takes effect when you do an MQGET from a queue.
Is there any way to make messages disappear from a queue automatically when they reach a certain age say, seven days?
Please make any responses fairly detailed, as I'm a bit new to all this!
many thanks |
|
Back to top |
|
 |
Prahasith |
Posted: Mon Nov 03, 2003 6:44 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
No, I don't think so.
The messages are removed from the queue only when you issue an MQGET although they have expired. |
|
Back to top |
|
 |
Blobtastic |
Posted: Mon Nov 03, 2003 6:58 am Post subject: |
|
|
Apprentice
Joined: 03 Nov 2003 Posts: 34 Location: uk
|
Many thanks for the lightning quick response!
I guess I'll just have to come up with a different way of housekeeping the queues.
My problem is that in the normal course of events we don't do any MQGET's from the queue - messages are put there by a third party product that we can't control! |
|
Back to top |
|
 |
Prahasith |
Posted: Mon Nov 03, 2003 7:15 am Post subject: |
|
|
 Disciple
Joined: 16 May 2003 Posts: 184 Location: Kansas City
|
You can also write a script to remove the expired messages and include it in the cronjobs. |
|
Back to top |
|
 |
zpat |
Posted: Mon Nov 03, 2003 7:59 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
There's another thread on how to purge expired messages on this BB.
Browsing the queue will do it for the distributed platforms. |
|
Back to top |
|
 |
Blobtastic |
Posted: Mon Nov 03, 2003 8:04 am Post subject: |
|
|
Apprentice
Joined: 03 Nov 2003 Posts: 34 Location: uk
|
Thanks zpat,
I think my point is, whether through GET or BROWSE, you actually need to perform something to make them expire - they can't be set / configured to automatically disappear?
Is that correct? |
|
Back to top |
|
 |
Carla Viragh |
Posted: Mon Nov 03, 2003 9:48 am Post subject: |
|
|
 Voyager
Joined: 31 Oct 2003 Posts: 92 Location: São Paulo - Brasil
|
Well, I don´t know if this is a good way... but if you are the MQ administrator, you can substitute the third part application´s queue to a model queue. Define it to create temporary dynamic queue. It means that the application will put messages in a temporary queue and when you restart the system, the queue and messages will disappear (but all of them wil be lost).
This is usual if the messages are not persistent.
Another way, you can create a application to analise the message age and decide to delete or not. _________________ Carla Viragh |
|
Back to top |
|
 |
jhalstead |
Posted: Mon Nov 03, 2003 9:49 am Post subject: |
|
|
 Master
Joined: 16 Aug 2001 Posts: 258 Location: London
|
Yes. Something needs to be done to allow the qmgr to recognise that the message has expired and is no longer of relevance.
The following is lifted from the WMQ Application Programming Reference guide in the section that goes over the MQMD headers fields:
When the message is retrieved by an application using the MQGET call, the Expiry field represents the amount of the original expiry time that still remains.
After a message’s expiry time has elapsed, it becomes eligible to be discarded by the queue manager. In the current implementations, the message is discarded when a browse or nonbrowse MQGET call occurs that would have returned the message had it not already expired. For example, a nonbrowse MQGET call with the MatchOptions field in MQGMO set to MQMO_NONE reading from a FIFO ordered queue will cause all the expired messages to be discarded up to the first unexpired message. With a priority ordered queue, the same call will discard expired messages of higher priority and messages of an equal priority that arrived on the
queue before the first unexpired message. A message that has expired is never returned to an application (either by a browse or a non-browse MQGET call), so the value in the Expiry field of the message descriptor after a successful MQGET call is either greater than zero, or the special value MQEI_UNLIMITED. |
|
Back to top |
|
 |
Carla Viragh |
Posted: Mon Nov 03, 2003 10:06 am Post subject: |
|
|
 Voyager
Joined: 31 Oct 2003 Posts: 92 Location: São Paulo - Brasil
|
Well... I´ve never tested it but seems to be simple, probably you just need to alter the queue manager attribute. Look:
EXPRYINT(integer)
Specifies how often queues are scanned to discard expired messages:
OFF: Queues are not scanned. No internal expiry processing is
performed. This is the default.
integer: The approximate interval in seconds at which queues are scanned.
Each time that 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 therefore whether a scan for expired
messages is worthwhile. So, only a selection of queues is scanned
at any time.
The value must be in the range 1 through 99 999 999. The
minimum scan interval used is 5 seconds, even if you specify a
lower value.
Note: You must set the same EXPRYINT value for all queue managers
within a queue-sharing group that support this attribute.
Changes to EXPRYINT take effect when the current interval expires, unless
the new interval is less than the unexpired portion of the current interval,
in which case a scan is scheduled immediately and the new interval value
takes immediate effect. _________________ Carla Viragh |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Nov 03, 2003 4:57 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
EXPRYINT is currently only supported on z/OS (mainframe) queue managers. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
Blobtastic |
Posted: Tue Nov 04, 2003 1:36 am Post subject: |
|
|
Apprentice
Joined: 03 Nov 2003 Posts: 34 Location: uk
|
Thanks everyone for all the responses to this. Its all been useful and educational, even if I've no workable solution yet! I'd have thought some sort of auto expiry of messages was a fairly elimentary design feature, but that obviously isn't the case.
Does anyone know if there is anything like EXPRYINT that works on an AIX box?
thanks again |
|
Back to top |
|
 |
Carla Viragh |
Posted: Tue Nov 04, 2003 4:46 am Post subject: |
|
|
 Voyager
Joined: 31 Oct 2003 Posts: 92 Location: São Paulo - Brasil
|
Oh God! You are right!
PeterPotkay wrote: |
EXPRYINT is currently only supported on z/OS (mainframe) queue managers. |
_________________ Carla Viragh |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Nov 05, 2003 5:34 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
The EXPRYINT doesn't actually "expire" the messages. It gets the messages removed from a queue that have already expired. It tells the qmgr how often to go looking for these messages. Each message has its own expiry associated with it. If you mark a message as unlimited, MQ won't go out and remove them because they won't expire. |
|
Back to top |
|
 |
GMcCarthy |
Posted: Thu Nov 06, 2003 9:19 am Post subject: |
|
|
 Centurion
Joined: 06 Nov 2001 Posts: 113 Location: Melville NY
|
Is this for QSG's only?? _________________ Regards,
Gina
IBM Certified MQSeries Specialist |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Nov 06, 2003 9:36 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
No, all queues. Since it is set at the queue manager level, all queues owned by the queue manager will have their expired messages cleaned up at the Interval TIme. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|