Can I stop a specific queue? - ibm-mq

Is it possible in IBM MQ through the console (command-line) to stop a queue?
I know how to stop a Queue Manager with endmqm. But can I run a console command which will stop one queue?

A queue cannot be stopped independently of the queue manager.
However, you may find that restricting puts and/or gets on/from the queue achieves your desired goal, depending on your setup. This will allow you to prevent applications from adding new messages to the queue and/or removing messages from the queue.
This can be done using commands in the runmqsc interface. https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.adm.doc/q083460_.htm
Here are the commands you'll need:
runmqsc QUEUE_MANAGER_NAME
ALTER QLOCAL('QUEUE_NAME') GET(DISABLED)
ALTER QLOCAL('QUEUE_NAME') PUT(DISABLED)
EXIT
Below is the commands and output for me disabling PUT and GET for my queue named Q1 on queue manager MyQM1.
mqa(mqcli)# runmqsc MyQM1
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager MyQM1.
ALTER QLOCAL('Q1') GET(DISABLED)
1 : ALTER QLOCAL('Q1') GET(DISABLED)
AMQ8008I: IBM MQ Appliance queue changed.
ALTER QLOCAL('Q1') PUT(DISABLED)
2 : ALTER QLOCAL('Q1') PUT(DISABLED)
AMQ8008I: IBM MQ Appliance queue changed.
I'd recommend trying this out in a test environment first, to ensure it meets your needs and that your applications behave correctly to the error messages. E.g. "MQGET calls are currently inhibited for the queue. (2016)"

Related

How to find the date of creation or first use of each channel in MQ Explorer?

We have have 5 channels in our IBM MQ Explorer for the App.To.REG queue manager.
I want to find the date of creation or first use of each channel.
I have tried both display channel and display chstatus command but it didn't gave the required details.
You will need an MQ Configuration and/or Monitoring tool for that type of information. Also, you will need to turn on the queue manager's Configuration Events. The DIS CHL() command will only give you the last altered date & time.

Websphere Message broker multi-instance message flow

I am looking for a command to change the message broker message flow instance in the run time. I know it is quite easy with MB explorer. But I am more interested towards the server side mqsi command. Ours is a AIX env with message broker 8 installed.
The number of instances a message flow has on the execution group is configured in the BAR file, before deployment.
If you want to change the number of additional instances you will need to redeploy your flow.
You can use the mqsiapplybaroverride command to change the configuration of the flow in the BAR file, and the mqsideploy command to redeploy the BAR.
As of IIB v9 you can control the number of instances dynamically at runtime by assigning a workload management policy.
See the description here:
http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/bn34262_.htm
Once you have assigned a policy you can change it using the mqsichangepolicy command specifying an xml policy document that has a different number of instances.
Alternatively you can use the web ui to change it directly on the running broker.

Run MQSC Command via SYSTEM.ADMIN.COMMAND.EVENT

I have connected remotely to a QMgr via MQ Explorer on Windows. The MQ server version is 7.5.0.1. I can put messages in SYSTEM.ADMIN.COMMAND.EVENT from MQ Explorer successfully and when I dump SYSTEM.ADMIN.COMMAND.EVENT, I can see my messages. As long as I know, I should be able to run PCF commands and MQSC commands via this channel. So, I put DISPLAY QMGR ALL message inside this queue and I can successfully see this message on MQ Server. My question is how can I run this message remotely via this channel? Thanks.
IBM Doc indicates that I should be able to receive the command result in SYSTEM.MQSC.REPLY.QUEUE. But I can not browse this queue from client MQ Explorer. The queue type for this queue is Model.
Couple of problems here.
First, you are using the wrong queue. The command server listens on SYSTEM.ADMIN.COMMAND.QUEUE. The queue to which you are sending messages, SYSTEM.ADMIN.COMMAND.EVENT is the queue to which the QMgr puts event messages after executing commands, provided of course that command events are enabled.
The second problem, as Jason mentions, is that the runmqsc processor takes human-readable script and converts it into commands the QMgr can understand. Passing textual commands directly to the command server won't work.
Typically we do what you want by passing the commands to runmqsc directly such as...
echo DISPLAY QMGR ALL | runmqsc MYQMGRNAME
If you require the ability to do this as a client, then you want to either download SupportPac MO72, or head over to MQ Gem and pick up a copy of MQSCX. Either of these will accept the command above on a local queue manager, and both can also be supplied with MQ Channel params and connect to a remote QMgr.
In addition to this basic functionality, the MQSCX product also has its own internal script parsing and execution. Suppose, for instance, that you want to do something depending on the command level of the QMgr.
Using runmqsc you could issue the command above, filter the resulting 2-column output through grep, awk, or similar, then capture the final output into a variable. You might need to do this multiple times to capture multiple values, invoking a new runmqsc each time and parsing the output in your script. You must then generate the string for the actual command you wanted to run when you started all this, and pass it to another invocation of runmqsc.
Alternatively, MQSCX lets you issue the DISPLAY command, then reference the resulting values directly by name. For example, you can pass MQSCX a couple lines of script telling it to inquire on the QMgr and then take a conditional action based on the command version, all without ever having to drop back into shell, bat or Perl script.
Full disclosure, I do not work for or get a commission from MQ Gem. I just don't like to beat my head against the wall writing 100 lines of code where 2 will do. If you do any amount of MQSC scripting, the ROI on MQSCX is measured in minutes. And it happens to be 100% on-topic as an answer to this question.
The command server doesnt process textual messages, it processes PCF messages. You need to build a message in PCF format and it can be processed. See http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.adm.doc/q019980_.htm
Ideally you would use real PCF format but there is a PCF format where you can send MQSC commands ('escaped' PCF - see here http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref.adm.doc/q087230_.htm?lang=en)

MQ V7.5.3 can anyone please advise on taking dump of subscriptions which are created by MQ API

Thanks for going thru this question.
We have installed ITCAM agent on MQ V7.5.0.3. Currently we had a scenario to clean out all the MQ objects and recreate it. While configuring ITCAM agent on MQ, there were few auto-created Subscriptions on Qmgr.
While taking dmpmqcfg -m these subscriptions are not captured ( as per info center "The dmpmqcfg utility dumps only subscriptions of type MQSUBTYPE_ADMIN, that is, only subscriptions that are created using the MQSC command DEFINE SUB or its PCF equivalent. Subscriptions that are created by applications using the MQSUB MQI call of type MQSUBTYPE_API are not part of the queue manager configuration, even if durable, and so are not dumped by dmpmqcfg")
Can anyone please advise how to take dump of all the subscriptions irrespective of created by DEFINE SUB or by some API's.
Thank you
You can issue the command DISPLAY SUB(*) TYPE(API) ALL to see them all.
dmpmqcfg does not dump them out because replaying them as DEFINE SUB commands would create TYPE(ADMIN) subscriptions.

Adding Additional Coordination Queue Managers in IBM MQ Explorer

Once one has a coordination queue manager in the "Managed File Transfer" folder of the IBM MQ Explorer (with the FTE add-on of course), how is it that one adds additional Coordination Queue managers? I don't see an "Add Coordiation Qmgr" option from the Managed File Transfer folder ... ?
You have to create a coordination queue manager using fteSetupCoordination command from command line.
fteSetupCoordination.cmd -coordinationQMgr QM_COORD2 -coordinationQMgrHost localhost -coordinationQMgrPort 3099 -coordinationQMgrChannel MQSVRCHN
This command will create a .mqsc file under config directory. That mqsc file must be run against the new coordination queue manager. For example:
runmqsc QM_COORD2 < C:\MQFTE\IBM\WMQFTE\config\QM_COORD2\QM_COORD2.mqsc
Start MQ Explorer, you will see QM_COORD2 as another coordination queue manager under Managed File Transfer node. Note that there can be only one coordination queue manager active at any point. Hence QM_COORD2 queue manager will be shown as inactive. You will need to disconnect the active coordination queue manager and then make the QM_COORD2 active. To make it active, just right click on the QM_COORD2 and click on Connect short menu.
And so following the resolution of a PMR, we find that my implementation of the FTE plugin for MQ explorer at v 7.0.1.2, was such that it precluded the detection of additional coordination queue managers. I deployed the v7.5 version, and EVERYTHING works fine now. Case closed.

Resources