|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Clearing Expired Messages |
« View previous topic :: View next topic » |
Author |
Message
|
klamerus |
Posted: Wed May 11, 2005 5:59 pm Post subject: Clearing Expired Messages |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Okay, in another thread, I got help to understand that we need to write something to clear out expired messages from one of our MQs.
We don't get lots of messages (maybe 5000-10000 / day), and we have things set to expire in a week.
We discovered (rather rudely when we ran out of space) that we need to actually need to browse each & every expired message in order to cause them to be removed from the queue.
I'm soliciting an algorithm for a small tool that will regularly clear off all the expired messages on our queue (say daily). Can anyone suggest something that would continue to browse until it found an unexpired message?
Thanks |
|
Back to top |
|
 |
EddieA |
Posted: Wed May 11, 2005 6:55 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Can anyone suggest something that would continue to browse until it found an unexpired message? |
Yes, anything that browses a queue. The 1st message returned would be an unexpired one. You will never see the expired ones. However, that assumes that all the messages have the same expiry, so that when you get the 1st unexpired message, there will be no expired ones further down the queue. If that's the case, then browse until you get a 2033.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
klamerus |
Posted: Thu May 12, 2005 2:37 am Post subject: Double check |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
What we are doing is putting the message on the queue in the order we get them.
We're using this queue to keep a spare copy of messages we get on another queue, before we process those messages. Unfortunately, some of the systems to which we send requests (with into in the messages) are not so reliable. This is a backup.
When we put the messages on the queue, we set the same expiry on all of them, and so every message is expired in the order that it is in the queue. There won't be an unexpired message in front of others that are expired, and worst case, this might be true very seldom and it would be expired upon the next check.
So you're saying that if we had 20,000 messages in the queue, and the first 2,000 were expired, and if we do a simple mqget on the queue at all, that all of the expired messages will be purged up until the first message that hasn't yet expired.
So, we don't need any kind of logic to detect that we did an mqget on an expired message and to therefore continue getting messages. MQ will automatically do that part of the work for us. (yes/no)? |
|
Back to top |
|
 |
klamerus |
Posted: Thu May 12, 2005 2:40 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Just to clarify. We set the same expiry value on every message we put in the queue (1 week), so every message should have a different expiry, but they should all be expired in the order they were put in. There should also not be any messages that are expired behind any that haven't yet expired.
But if there were and browse saw the first "good" message and left the other unexpired messages that would be fine, because we would purge that on the next day's check on the queue.
What appears to have happened in our case, is we didn't know that the expiring messages weren't being cleared by mq on it's own. Hence, the queue grew and grew. It eventually reached the storage limit and further put commands began failing. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu May 12, 2005 6:14 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
WMQ won't return the expired messages to you. It will discard them and return the first 'good' message. As far as a utility to periodically clear the queue of expired messages, you could simply run the amqsbcg sample against the queue. It browses every message in the queue which would get the expired ones discarded. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 12, 2005 6:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
bower5932 wrote: |
WMQ won't return the expired messages to you. |
Unless you specify an expiration report with full data. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klamerus |
Posted: Thu May 12, 2005 2:08 pm Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Well from what someone just said, that program (sample) browses every message on the queue, which will be hundreds of thousands.
From what someone else just said, doing a single get will cause all the MQ to jettison all the expired messages on the top of the queue and then hand me back the first unexpired, which is just fine. I really don't want to cruise through all the others. All the expired ones are on top. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|