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 » Batch job to clear a local queue

Post new topic  Reply to topic
 Batch job to clear a local queue « View previous topic :: View next topic » 
Author Message
divyagutpa01
PostPosted: Wed Jul 01, 2009 7:50 am    Post subject: Batch job to clear a local queue Reply with quote

Newbie

Joined: 01 Jul 2009
Posts: 2

Hi,

I need to create a batch job to clear a local queue at specific intervals.
I created a batch job using the command
RUNMQSC BOLDAPP02 < ClearQueue.in

where BOLDAPP02 is my Queue Manager and the content of the ClearQueue.in are as follows:

CLEAR QLOCAL(<local queue name>)

But sometimes it works and sometimes it gives the error AMQ8148: WebSphere MQ object in use.

How can i fix this? The other options to clear a queue are:

1)Do a destructive GET on the queue.
2)MQGET/browse on the queue.

But I dont know how to use them. Any help is appreciated.

Thanks,
Divya


Last edited by divyagutpa01 on Wed Jul 01, 2009 7:58 am; edited 1 time in total
Back to top
View user's profile Send private message
divyagutpa01
PostPosted: Wed Jul 01, 2009 7:54 am    Post subject: Reply with quote

Newbie

Joined: 01 Jul 2009
Posts: 2

The content of the ClearQueue.in are as follows:

CLEAR QLOCAL(<local queue name>)
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jul 01, 2009 9:03 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.

They way I understand it, the mqsc command 'clear qlocal(qname)' will only work when there are no active queue handles on that queue. i.e. the queue is open somewhere.

The way to be sure of clearing the messages even if a process hass the queue open is to read the messages one by one.

I have a modified version of amqsget that does this. I modified it to allow truncated messages which is what you will get if you try to use the standard application.
_________________
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
JosephGramig
PostPosted: Wed Jul 01, 2009 9:20 am    Post subject: Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1244
Location: Gold Coast of Florida, USA

This this is posted in the WMB forum, I assume you could use a flow. You could pass the name of the queue to clear into a flow and use MQGET to drain it.

Not that I'm saying this is a great idea...
Back to top
View user's profile Send private message AIM Address
Vitor
PostPosted: Wed Jul 01, 2009 1:54 pm    Post subject: Re: Batch job to clear a local queue Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

divyagutpa01 wrote:
I need to create a batch job to clear a local queue at specific intervals.


Why not just set the messages to expiry?

divyagutpa01 wrote:
But sometimes it works and sometimes it gives the error AMQ8148: WebSphere MQ object in use.


It will do if something's using the queue when your job runs. This is another advantage of expiry.

divyagutpa01 wrote:
How can i fix this? The other options to clear a queue are:

1)Do a destructive GET on the queue.
2)MQGET/browse on the queue.


These are the only options.

divyagutpa01 wrote:
But I dont know how to use them. Any help is appreciated.


The modified amqsget is probably the best bet.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Batch job to clear a local queue
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.