Author |
Message
|
divyagutpa01 |
Posted: Wed Jul 01, 2009 7:50 am Post subject: Batch job to clear a local queue |
|
|
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 |
|
 |
divyagutpa01 |
Posted: Wed Jul 01, 2009 7:54 am Post subject: |
|
|
Newbie
Joined: 01 Jul 2009 Posts: 2
|
The content of the ClearQueue.in are as follows:
CLEAR QLOCAL(<local queue name>) |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jul 01, 2009 9:03 am Post subject: |
|
|
 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 |
|
 |
JosephGramig |
Posted: Wed Jul 01, 2009 9:20 am Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Wed Jul 01, 2009 1:54 pm Post subject: Re: Batch job to clear a local queue |
|
|
 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 |
|
 |
|