|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Clearing all messages in a queue manager |
« View previous topic :: View next topic » |
Author |
Message
|
PaulClarke |
Posted: Tue Mar 31, 2015 9:20 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
tczielke,
For a simple task such as this I agree that write an OS script is not too arduous although I would argue that it is still much more complicated and difficult to maintain plus it is platform/shell dependant. As one adds more conditions the script could get rather messy. I think you also have a bug in the script. Would it not bypass a queue such as APPLICATION.SYSTEM.DATA ? Although I think the fix is pretty easy.
As for emptying the queue my MA01 (Q) would do it with a command such as q -m QM1 -I MYQ -q and would be happy with any message size.
Cheers,
Paul _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
tczielke |
Posted: Tue Mar 31, 2015 10:05 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
PaulClarke wrote: |
tczielke,
For a simple task such as this I agree that write an OS script is not too arduous although I would argue that it is still much more complicated and difficult to maintain plus it is platform/shell dependant. As one adds more conditions the script could get rather messy. I think you also have a bug in the script. Would it not bypass a queue such as APPLICATION.SYSTEM.DATA ? Although I think the fix is pretty easy.
As for emptying the queue my MA01 (Q) would do it with a command such as q -m QM1 -I MYQ -q and would be happy with any message size.
Cheers,
Paul |
Yes, I agree with everything you said. Also, here is a correction to that script to only exlucde queues that start with SYSTEM.
echo "dis ql(*) where (CURDEPTH GE 1)" | runmqsc QM1 | grep -v "(SYSTEM." | grep "QUEUE(" | cut -d'(' -f2 | cut -d')' -f1 | while read LineTx; do echo amqsget $LineTx QM1;done _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
tczielke |
Posted: Tue Mar 31, 2015 10:22 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
Vitor wrote: |
tczielke wrote: |
So I guess if your queues have larger messages, use your MQ getter program of choice. |
Or recompile the amqsget sample to a) accept larger messages or b) warn rather than fail if truncating. |
Or if you are feeling adventurous and ornery, ZAP the amqsget module and change the GMO options from x'00004005' to x'00004045' to add in the MQGMO_ACCEPT_TRUNCATED_MSG option.
Unfortunately, based on the amsget logic, this only successfully GETs the truncated message, but the program stops processing since it receives a 2079 on the accepted truncated GET.
Of course, the best way to go is to just use a getting application that can handle this appropriately, like the q program that Paul mentioned. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
PaulClarke |
Posted: Tue Mar 31, 2015 10:27 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Actually, at the risk of appearing pedantic, are you sure that grep string is right? The dot '.' character has special meaning in regular expressions doesn't it? Doesn't it match any character. So, wouldn't your grep also exclude queues such as SYSTEMATICS.TEST ?
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
tczielke |
Posted: Tue Mar 31, 2015 10:38 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
PaulClarke wrote: |
Actually, at the risk of appearing pedantic, are you sure that grep string is right? The dot '.' character has special meaning in regular expressions doesn't it? Doesn't it match any character. So, wouldn't your grep also exclude queues such as SYSTEMATICS.TEST ?
Cheers,
Paul. |
You are correct! I don't consider myself an expert with scripting, but I think this would work. At least, it picked up your SYSTEMATICS.TEST example.
echo "dis ql(*) where (CURDEPTH GE 1)" | runmqsc | grep -v "(SYSTEM\." | grep "QUEUE(" | cut -d'(' -f2 | cut -d')' -f1 | while read LineTx; do echo amqsget $LineTx;done _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
md7 |
Posted: Tue Mar 31, 2015 9:12 pm Post subject: |
|
|
 Apprentice
Joined: 29 Feb 2012 Posts: 49 Location: Sydney.AU
|
Thanks for the replies.. I ended up exporting the queue manager, deleting the queue manager and creating it again. btw it was on a Windows OS |
|
Back to top |
|
 |
PaulClarke |
Posted: Wed Apr 01, 2015 12:36 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
In the interests of 'getting the scripts right' it has been pointed out to me that actually my 'clear all queues' script can be simplified still further since MQSCX supports WHERE clauses with multiple expressions. So, the script need only be....
Code: |
* Get all of the queues
foreach(DISPLAY QLOCAL(*) CURDEPTH =WHERE(curdepth & queue NL "SYSTEM.*"))
@queue = QUEUE
CLEAR QLOCAL(<@queue>)
endfor
|
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|