Author |
Message
|
sagis_raj |
Posted: Mon Dec 12, 2005 8:44 am Post subject: Suggestion on Purging Queues |
|
|
Novice
Joined: 28 Jul 2005 Posts: 23
|
Hi All,
I have a issue and Issue is.
I have to delete all the Messages from the queue when the queue depth reaches 80%.
Could some one suggest what is the best solution to do so.
what are all the considerations should be taken.
Thanks in Advace.
Regards
Raju |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 12, 2005 8:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The queue depth should not get that high.
Messages should not sit on queues, and need to be manually or automatically removed by a utility.
They should be clearly and simply removed by business applications, which process the data in the messages. If the applications are not removing the messages, then they are not doing the right thing.
If a queue gets full, it should mean that an application is not doing it's job - and the application needs to be investigated. And usually, all the messages in the queue still need to be processed, and so shouldn't be deleted by an administrator.
If it is okay to empty the queue when the qdepth gets to 80%, why not empty it when the qdepth gets to 20%... or to 2 messages?
Any tool that can do an MQGET can clear the queue for you - one message at a time. The MQSC command "Clear Queue" can remove all messages, if there is not an Open Input Count on the queue at the time the command is run (this may be overridable in v6). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sagis_raj |
Posted: Mon Dec 12, 2005 8:59 am Post subject: |
|
|
Novice
Joined: 28 Jul 2005 Posts: 23
|
Hi Jeff,
i am not using an application to put the messages in the queue. i am using a WBI ICS .but the messages are read from the queue the messges will be archived into Archive Queue.Now using a program i have to remove all the messages.
1.should i need to set any headers to inorder to remove the messages.
2.which API is best to use.(SUN Java API or java api for websphere mq) |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 12, 2005 9:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What is the point of putting them in the queue, only to delete them later?
If you clear the queue when the qdepth reaches 80%, you will remove all messages regardless of how old they are. So a message that just got put on the queue one second before you cleared it, will be gone.
If you configure ICS (which *is* an application) to set an expiration time on the messages, then you can simply run a utility like amqsbcg once a day, and it will clean out all the exipred messages.
The APIs are functionally equivalent. Which is best depends on what you know best.
You are probably a lot better off using ICS to store the messages in a database table, and writing an INSERT-triggered stored procedure to delete rows older than a certain time period.
Then you can use ICS or something else to retrieve a message from the database, and recreate it as a message to go back on a queue, if you need to resend it. Or you can view the messages using normal database viewing techniques (db client, web app, etc). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
tinye |
Posted: Tue Dec 13, 2005 1:10 pm Post subject: |
|
|
Novice
Joined: 02 Aug 2005 Posts: 17 Location: OHIO
|
Quote: |
What is the point of putting them in the queue, only to delete them later? |
I get a chuckle out of this because it is exactly what I'm doing. On the surface, it probably doesn't make sense; but it gets me where I need to be.
I have an application that puts messages onto a queue. It has some problems where if too much time elapses between puts, it loses its connection to the queue and can't work again until the application is restarted.
To prevent the timeout, I have the application putting a "dummy" message on a separate queue on a timed basis, like every 10 minutes or so. That keeps everything greased and running.
I'd like to be able to programmatically clear out the queue on a regular basis; but as a non-programmer, the best I've come up with so far is a scheduled task running a .bat file to get (which I haven't even gotten working so well yet)  |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue Dec 13, 2005 5:47 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
tinye wrote: |
I have an application that puts messages onto a queue. It has some problems where if too much time elapses between puts, it loses its connection to the queue and can't work again until the application is restarted.
To prevent the timeout, I have the application putting a "dummy" message on a separate queue on a timed basis, like every 10 minutes or so. That keeps everything greased and running.
|
If all you are looking to do is stay greasy, just to a MQPUT every 10 minutes to a queue called IamTryingToStayGreasy, and ignore the 2085 error code for this put. You talk with the QM every 10 minutes, and you don't have to deal with clean up.
Of course, the real solution is to find out why the connection is cutting out on you. Firewall involved? _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
tinye |
Posted: Wed Dec 14, 2005 11:48 am Post subject: |
|
|
Novice
Joined: 02 Aug 2005 Posts: 17 Location: OHIO
|
I like that idea!
No firewall between.....the application and MQ reside on the same server; but the application does rely on communication across a firewall to some additional servers.
But your solution keeps all my other pieces working and just keeps me from needing to clean out the queue.
Thanks! |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 14, 2005 3:49 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
if not some firewall maybe some network monitoring tool that pings the port every so often ??
Enjoy  |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Dec 14, 2005 4:56 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
that's right. We finnaly nailed down the cause of a lot of our apps getting 2009s while at the same time seeing 10054 TCP errors in our QM logs at the same time. Our security dept. was scanning during the day with a tool call nCircle. Our network guys help pinpoint the cause. As soon as the scans stopped, so did the dropped connections. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|