Author |
Message
|
hp1411 |
Posted: Sat Oct 17, 2015 4:54 pm Post subject: How to drop connections to a queue |
|
|
Newbie
Joined: 17 Oct 2015 Posts: 9
|
Hello All,
I am a complete newbie to MQ and had a question regarding clearing messages of a queue.
I have noticed that the clear qlocal command will clear all the messages of a queue if there are no open connections.
Is there a way to drop all the connections to a queue so that I can clear it? OR if there a way to force a clear queue command?
Thanks!! |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Oct 17, 2015 7:06 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If there are processes attached to the queue you usually use the MQExplorer to clear the queue doing a destructive get. Takes a little bit longer but works for a queue that is in use.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mo_lightapps |
Posted: Sat Oct 17, 2015 7:44 pm Post subject: |
|
|
Novice
Joined: 12 Oct 2015 Posts: 18
|
You haven't said how the client is connected to the queue manager. I will assume that its a server connection channel. If so, you need to issue a stop channel command:
runmqsc <QMGR>
dis chs(<CHANNEL_NAME>)
stop channel(<CHANNEL_NAME>) mode(force)
dis chs(<CHANNEL_NAME>)
The dis chs command on either side of the stop channel will show you whether or not it worked. If that still doesnt work, change mode to "terminate".
Note that these commands are safe to run but may cause duplicates as they mess with the acknowledgement status of messages being published or consumed at the time the command is issued. Also this will take out connections to other queues as well (if that's the case here). _________________ LightApps - Creators of Lighthouse software. Modern web based management of messaging systems IBM MQ and Solace - queue browsing, automated configuration deployment and monitoring.
www.lightapps.com.au |
|
Back to top |
|
 |
gbaddeley |
Posted: Sun Oct 18, 2015 4:15 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
fjb_saper wrote: |
If there are processes attached to the queue you usually use the MQExplorer to clear the queue doing a destructive get. Takes a little bit longer but works for a queue that is in use.  |
Unless any processes have the queue open for exclusive input. Setting get inhibit on the queue might get rid of them. _________________ Glenn
Last edited by gbaddeley on Tue Oct 20, 2015 3:01 pm; edited 1 time in total |
|
Back to top |
|
 |
mo_lightapps |
Posted: Sun Oct 18, 2015 4:51 pm Post subject: |
|
|
Novice
Joined: 12 Oct 2015 Posts: 18
|
gbaddeley wrote: |
fjb_saper wrote: |
If there are processes attached to the queue you usually use the MQExplorer to clear the queue doing a destructive get. Takes a little bit longer but works for a queue that is in use.  |
Unless any processes have the queue open for exclusive input. Setting put inhibit on the queue might get rid of them. |
Watch out for cases where the client has a handle and connection open for an extended period in which case it may not take affect until these are recycled. _________________ LightApps - Creators of Lighthouse software. Modern web based management of messaging systems IBM MQ and Solace - queue browsing, automated configuration deployment and monitoring.
www.lightapps.com.au |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Oct 18, 2015 5:51 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
You might want to use the DISPLAY QSTATUS (queue-name) TYPE(HANDLE)
to see which apps have the queue open.
As my colleague mentioned, if the app keeps the queue open for a extended time period, you can put/get inhibit the queue to cause the next use of the queue to fail. You might also want/need to use an o/s primitive command to cancel the application(s). _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 19, 2015 4:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
gbaddeley wrote: |
fjb_saper wrote: |
If there are processes attached to the queue you usually use the MQExplorer to clear the queue doing a destructive get. Takes a little bit longer but works for a queue that is in use.  |
Unless any processes have the queue open for exclusive input. Setting put inhibit on the queue might get rid of them. |
You're talking about exclusive input => I would have thought that implied a get inhibit?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Raman Kathpalia |
Posted: Mon Oct 19, 2015 6:21 am Post subject: Re: How to drop connections to a queue |
|
|
 Newbie
Joined: 22 Jan 2015 Posts: 9 Location: New York, New York
|
hp1411 wrote: |
Hello All,
I am a complete newbie to MQ and had a question regarding clearing messages of a queue.
I have noticed that the clear qlocal command will clear all the messages of a queue if there are no open connections.
Is there a way to drop all the connections to a queue so that I can clear it? OR if there a way to force a clear queue command?
Thanks!! |
If clearing queue is the only concern then you don't need to drop the IPPROCS and OPPROCS to achieve it.
Try:
Code: |
dmpmqmsg -m QMGRNAME -I QUEUE_NAME -F /dev/null -p |
http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref.adm.doc/q117660_.htm
use /dev/null equivalent for your OS if it's not *nix based.
Assuming you're on one of newer versions of MQ.
Cheers! |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Oct 19, 2015 3:14 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
mo_lightapps wrote: |
The dis chs command on either side of the stop channel will show you whether or not it worked. If that still doesnt work, change mode to "terminate".
|
Potentially dangerous. Kills the amqrmppa process, which can have up to 64 threads...that's up to 63 other channels other than the one you want to stop that will also be killed. Also if you have an exit in play on the channels, how will that react when the channel process is abruptly killed. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
gbaddeley |
Posted: Tue Oct 20, 2015 3:02 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
fjb_saper wrote: |
gbaddeley wrote: |
fjb_saper wrote: |
If there are processes attached to the queue you usually use the MQExplorer to clear the queue doing a destructive get. Takes a little bit longer but works for a queue that is in use.  |
Unless any processes have the queue open for exclusive input. Setting put inhibit on the queue might get rid of them. |
You're talking about exclusive input => I would have thought that implied a get inhibit?  |
yeah, should have said get inhibit. I have edited my original post to protect the guilty. G. _________________ Glenn |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 20, 2015 8:30 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
gbaddeley wrote: |
yeah, should have said get inhibit. I have edited my original post to protect the guilty. G. |
No problem. That's why the more advanced users here catch each other's typos... so that the newbies might learn...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|