Author |
Message
|
vishnalz |
Posted: Tue Nov 02, 2010 3:18 pm Post subject: Automatically Deleting message from a queue |
|
|
Newbie
Joined: 02 Nov 2010 Posts: 1
|
We have a situation we have a MQ queue which contains messages which we never process (I know its messy but this how it is implemented).
Now i want to delete all the messages automatically , as and when it arrives, from this queue.
Can we do it with some configuration at queue manager , without writing any utility.
However I have a solution already in place. Its a MDB which polls that queue and as it receive a message we consume the message and do nothing. But I want to avoid that.
Any better solution option or configuration?
Many thanks in advance. |
|
Back to top |
|
 |
jeevan |
Posted: Tue Nov 02, 2010 3:32 pm Post subject: Re: Automatically Deleting message from a queue |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
vishnalz wrote: |
We have a situation we have a MQ queue which contains messages which we never process (I know its messy but this how it is implemented).
Now i want to delete all the messages automatically , as and when it arrives, from this queue.
Can we do it with some configuration at queue manager , without writing any utility.
However I have a solution already in place. Its a MDB which polls that queue and as it receive a message we consume the message and do nothing. But I want to avoid that.
Any better solution option or configuration?
if the messages are not useful at all, why you are receiving them? you can ask them to not to send at all?
if the messages are useless, ask the sender to not to send. why you want to spend time and effort for futile task.
Many thanks in advance. |
Last edited by jeevan on Tue Nov 02, 2010 5:02 pm; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 02, 2010 4:17 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can't cause the qmgr to automatically clear a queue every so often.
You can cause the messages on it to expire after a given period of time - if you set this on the sender app.
You could run a script to periodically CLEAR QLOCAL(q_name). |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Nov 02, 2010 6:58 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqjeff wrote: |
You can't cause the qmgr to automatically clear a queue every so often.
You can cause the messages on it to expire after a given period of time - if you set this on the sender app.
You could run a script to periodically CLEAR QLOCAL(q_name). |
Or write a program to MQGET the messages on the queue until empty... an run it periodically ...  _________________ MQ & Broker admin
Last edited by fjb_saper on Wed Nov 03, 2010 7:14 am; edited 1 time in total |
|
Back to top |
|
 |
shashivarungupta |
Posted: Wed Nov 03, 2010 1:32 am Post subject: |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
jeevan wrote: |
if the messages are not useful at all, why you are receiving them? you can ask them to not to send at all? |
vishnalz: but this how it is implemented
mqjeff wrote: |
You can cause the messages on it to expire after a given period of time - if you set this on the sender app. |
Agree !! And that would minimize your efforts !!
vishnalz wrote: |
Can we do it with some configuration at queue manager , without writing any utility. |
nope. qmgr is not getting the dreams that it has to clear the queue, unless you trigger some utility to do so. _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Nov 03, 2010 4:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
shashivarungupta wrote: |
nope. qmgr is not getting the dreams that it has to clear the queue |
Instructions come to your queue manager in it's dreams? It's a wonderfully poetic concept but I prefer my queue managers to be awake, alert and hanging on my every word of command.
Still, horses for courses.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Wed Nov 03, 2010 6:44 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Trigger on queue depth perhaps, a program to read the messages.
WMB could be used to consume messages as they arrive.
However a "black hole" queue (bit like //XX DD DUMMY in z/OS JCL) would be useful. |
|
Back to top |
|
 |
SAFraser |
Posted: Wed Nov 03, 2010 9:46 am Post subject: |
|
|
 Shaman
Joined: 22 Oct 2003 Posts: 742 Location: Austin, Texas, USA
|
We need to do this in some of our development environments, as we don't always have trading partner connections that consume messages.
My teammate altered the sample program 'amqsget' to increase the message buffer size. We trigger the utility based on 'depth'. This works fine unless it is a busy queue; if messages arrive constantly and the queue depth never reaches zero, the 'get' utility runs forever. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 03, 2010 11:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
SAFraser wrote: |
We need to do this in some of our development environments, as we don't always have trading partner connections that consume messages.
My teammate altered the sample program 'amqsget' to increase the message buffer size. We trigger the utility based on 'depth'. This works fine unless it is a busy queue; if messages arrive constantly and the queue depth never reaches zero, the 'get' utility runs forever. |
Wow you have really busy queues.
I get (in the same network using JMS) and a single thread commit every 1,000 (IIRC):
- 217,799 records deleted in 00:02:09.120 s (client connection)
- 213,400 records deleted in 00:01:02.705 s (bindings connection)
- 201,917 records deleted in 00:01:53.427 s (client connection)
Read records as messages average size < 4 K
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Wed Nov 03, 2010 12:11 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
SAFraser wrote: |
My teammate altered the sample program 'amqsget' to increase the message buffer size. |
I've seen the same thing done, but with the buffer left at default & accept truncated messages set on.
2 roads to the same destination. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
SAFraser |
Posted: Wed Nov 03, 2010 5:50 pm Post subject: |
|
|
 Shaman
Joined: 22 Oct 2003 Posts: 742 Location: Austin, Texas, USA
|
fjb_saper wrote: |
SAFraser wrote: |
We trigger the utility based on 'depth'. This works fine unless it is a busy queue; if messages arrive constantly and the queue depth never reaches zero, the 'get' utility runs forever. |
Wow you have really busy queues.
I get (in the same network using JMS) and a single thread commit every 1,000 (IIRC):
- 217,799 records deleted in 00:02:09.120 s (client connection)
- 213,400 records deleted in 00:01:02.705 s (bindings connection)
- 201,917 records deleted in 00:01:53.427 s (client connection)
|
You are doing a destructive get? Holy cow, that's fast.
The one time we got into serious trouble was a load test on a queue manager that lives on the evil zfs file system on the evil Solaris sparse zone. Read times are miserable. Got ourselves into a mess of sorts. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 03, 2010 8:12 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
SAFraser wrote: |
You are doing a destructive get? Holy cow, that's fast.
The one time we got into serious trouble was a load test on a queue manager that lives on the evil zfs file system on the evil Solaris sparse zone. Read times are miserable. Got ourselves into a mess of sorts. |
Yep, stand alone JMS program, java 32 bit, using standard receivenowait() and commit every 1,000 messages on AIX. The program is driven by a bunch of property files. One file for overall properties and a list of qmgrs. Then a property file per qmgr with connection details and a list of queues to clear. All I do is a receive and go to the next message. Like I said these are small messages < 4 KB. But that is the time experienced from before the first until after the last receive and commit.
The network is 100 GB Ethernet and the 3 boxes are in the same location.
The java JMS standalone program obviously runs on one of them (otherwise no binding connection). Disk is SAN. Most of the time is spent creating the connection and creating the receiver. Note that that time is not included in the stats I provided.
So far garbage collection is standard. I may experiment next with parallelNewGC and concurrentMarkSweepGC... to see if this speeds it up even more.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Nov 03, 2010 9:11 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
Vitor wrote: |
I've seen the same thing done, but with the buffer left at default & accept truncated messages set on. |
For discarding messages, setting the buffer length to 0, buffer to NULL, (and accept truncated messages) also works. |
|
Back to top |
|
 |
shashivarungupta |
Posted: Wed Nov 03, 2010 11:29 pm Post subject: |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
Vitor wrote: |
shashivarungupta wrote: |
nope. qmgr is not getting the dreams that it has to clear the queue |
Instructions come to your queue manager in it's dreams? It's a wonderfully poetic concept but I prefer my queue managers to be awake, alert and hanging on my every word of command. |
Nope..my qmgr doesn't get command in its dreams but vishnalz hallucinates if that could have been possible ever at his end.  _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
|