ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to purge messages in MQ queue using Message Broker?

Post new topic  Reply to topic
 How to purge messages in MQ queue using Message Broker? « View previous topic :: View next topic » 
Author Message
dan2WMB
PostPosted: Wed Feb 02, 2011 11:10 pm    Post subject: How to purge messages in MQ queue using Message Broker? Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Wed Feb 02, 2011 11:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
dan2WMB
PostPosted: Thu Feb 03, 2011 12:00 am    Post subject: Reply with quote

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
View user's profile Send private message
fatherjack
PostPosted: Thu Feb 03, 2011 1:47 am    Post subject: Re: How to purge messages in MQ queue using Message Broker? Reply with quote

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
View user's profile Send private message
rekarm01
PostPosted: Thu Feb 03, 2011 2:16 am    Post subject: Re: How to purge messages in MQ queue using Message Broker? Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Thu Feb 03, 2011 5:33 am    Post subject: Re: How to purge messages in MQ queue using Message Broker? Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
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
View user's profile Send private message
fatherjack
PostPosted: Thu Feb 03, 2011 6:15 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Thu Feb 03, 2011 6:19 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
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
View user's profile Send private message
smdavies99
PostPosted: Thu Feb 03, 2011 7:05 am    Post subject: Reply with quote

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
View user's profile Send private message
PeterPotkay
PostPosted: Thu Feb 03, 2011 4:43 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7716

The sending application should set Expiry appropriately on these messages.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to purge messages in MQ queue using Message Broker?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.