Author |
Message
|
dan2WMB |
Posted: Wed Feb 02, 2011 11:10 pm Post subject: How to purge messages in MQ queue using Message Broker? |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
Hi,
I just want to know,is there any we can purge messages stored in the MQ queue using Message Broker(throw nodes/ESQL)?
Please help me on this. |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Feb 02, 2011 11:24 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The best (and safest) way would be for your flow to issue PCF Calls to WMQ. This has been discussed before in this forum. It is not for the faint hearted though. PCF has a wierd & wonderful format all of its own.
You could just read the messages off the queue usingthe MQGet Node in a loop but that is really a No-No as far as broker is concerned. You might blow up your EG if the loop count gets too large.
The old school coder in me would simply pull some C code out my toolbox and use that. Setup an MQGet with Truncated Messages Alowed in the MQGMO and read away using the same input buffer of 100bytes until I get a 2033 return.
Send the application a message that contains the name of the queue to be 'cleared'. That is a hack but works outside of Broker... (this is a modified AMQSGET.c by the way) _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
dan2WMB |
Posted: Thu Feb 03, 2011 12:00 am Post subject: |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
can u just elaborate more this please?I am thinking, i can do this with JavaComputeNode and issue MQI calls from there to purge the messages.Is that right? |
|
Back to top |
|
 |
fatherjack |
Posted: Thu Feb 03, 2011 1:47 am Post subject: Re: How to purge messages in MQ queue using Message Broker? |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
dan2WMB wrote: |
Hi,
I just want to know,is there any we can purge messages stored in the MQ queue using Message Broker(throw nodes/ESQL)?
Please help me on this. |
Why would you want to do it using Message Broker? There must be better utilities around for doing this. _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Feb 03, 2011 2:16 am Post subject: Re: How to purge messages in MQ queue using Message Broker? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
dan2WMB wrote: |
I just want to know,is there any we can purge messages stored in the MQ queue using Message Broker(throw nodes/ESQL)? |
A message flow with just an unattached MQInput node should do the job, ... unless there are more specific requirements. |
|
Back to top |
|
 |
zpat |
Posted: Thu Feb 03, 2011 5:33 am Post subject: Re: How to purge messages in MQ queue using Message Broker? |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
rekarm01 wrote: |
dan2WMB wrote: |
I just want to know,is there any we can purge messages stored in the MQ queue using Message Broker(throw nodes/ESQL)? |
A message flow with just an unattached MQInput node should do the job, ... unless there are more specific requirements. |
Indeed - why make things more complex than they need to be? This will also work for queues that are open (e.g. for browse) whereas a PCF clear command won't. You can leave the flow running all the time to soak up unwanted messages if that is the desired effect.
If you want occasionally to clear down you could use something like MA01 (the Q program) to empty the queue with destructive gets. PCF is more efficient if the depth is very high, as long as the queue is not open. |
|
Back to top |
|
 |
fatherjack |
Posted: Thu Feb 03, 2011 6:15 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
I do wonder what the real requirement is here. Because if all you are doing is purging the messages as soon as they arrive they must have zero business value. So why are they getting put in the first place?
Unless you're just pinging messages around your MQ network to make sure its still all up and running OK? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
zpat |
Posted: Thu Feb 03, 2011 6:19 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Also the DLQ handler, runmqdlq, can be run against any queue, not just the system DLQ and will provide a configurable set of options. You could also trigger this on queue depth.
Actually - this needs a DLH in the messages, but you could modify the sample version. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Feb 03, 2011 7:05 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The Job Control Node Support PAck may well come in useful for invoking scripts external to Broker to do this sort of tidying up. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Feb 03, 2011 4:43 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
The sending application should set Expiry appropriately on these messages. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|