IBM Support

Usage notes regarding the 'default' MQ queue manager

Question & Answer


Question

Usage notes regarding the 'default' MQ queue manager

Answer


+ When to use a 'default' MQ queue manager?
If you have only 1 queue manager in a host, or
If you have several queue managers but the vast majority of the time, 1 of the queue managers is used.
.
+ What are the benefits?
If you have a 'default' queue manager, then ...

1) ... you do not have to explicitly name it when working with runmqsc.
For example:
If the 'default' queue manager is QM80
then instead of invoking runmqsc with an explicit name such as:
   runmqsc QM80
.
... then you can omit the name and issue simply:
  runmqsc

2) ... it will be the queue manager that applications connect to if they do not specify a queue manager name in an MQCONN call.

+ How to designate a queue manager as the default?
Notes:
There can be only 1 default queue manager.
If there is already a default queue manager, if you specify another queue manager as the default, then the new queue manager name will override the older one, as the default queue manager.
There is no need to restart the queue manager that is designated as the default queue manager.
.
a) By using the -q flag with crtmqm
or by specifying the appropriate field in the wizard in MQ Explorer.
b) If there is no default queue manager, then designate a queue manager as a the default, there is only 1 step needed:
To add the stanza in the file /var/mqm/mqs.ini
DefaultQueueManager:
   Name=QM80
Or to specify it in the Properties in the MQ Explorer:
IBM MQ > Properties > General > Default queue manager name
image-20200221135818-1

+ How to remove the designation of default queue manager
If you do not want to have a default queue manager, then edit mqs.ini and delete the stanza DefaultQueueManager (and the subsequent line that has the Name)
.
Or you can blank out the Property in the MQ Explorer.
+ Are there any considerations for Multi-Instance queue managers?
Yes: if you have a multi-instance queue manager designated as the default in host-1, it is best to have the same queue manager designated as the default in host-2.
Why? Because most likely you may have scripts or procedures that do not specify explicitly the queue manager name, and if there is no default queue manager in host-2, then you may get confused on why the scripts work fine with host-1, but fail with host-2.

+ Let's illustrate with an example:
mqm@aztlan1.fyre.ibm.com:
$ cd /var/mqm
Note that there is no DefaultQueueManager stanza in the mqs.ini
$ tail mqs.ini
QueueManager:
   Name=QM910
   Prefix=/var/mqm
   Directory=QM910
   InstallationName=Installation2
$ dspmq
QMNAME(QM80)                                              STATUS(Running)
QMNAME(QMMIG)                                             STATUS(Ended immediately)
QMNAME(QM910)                                             STATUS(Running)
Note that when not using explicitly the queue manager name and there is no default queue manager then the reason code is 2059
2059  0x0000080b  MQRC_Q_MGR_NOT_AVAILABLE
$ amqsput Q2
Sample AMQSPUT0 start
MQCONNX ended with reason code 2059
Let's add the stanza for the default queue manager in mqs.ini and designate QM80 as the default.
$ tail mqs.ini
   Directory=QMMIG
   InstallationName=Installation2
QueueManager:
   Name=QM910
   Prefix=/var/mqm
   Directory=QM910
   InstallationName=Installation2
DefaultQueueManager:
   Name=QM80
Note that now the MQ application is able to connect to the default queue manager (because it is specified in the mqs.ini file)
$ amqsput Q2
Sample AMQSPUT0 start
target queue is Q2
testing default queue manager
Sample AMQSPUT0 end
Note that the name in the mqs.ini for the default queue manager is used when the queue manager name is NOT explicitly indicated in the command.
But if the name of the queue manager is explicitly indicated in the command, then that explicit name is used.
In other words, the default queue manager name does NOT override an explicit queue manager name.
For example, even though the default queue manager name is QM80, if the MQ command is invoked with another queue manager name (such as QM910), then the explicit name is used (and not the default queue manager name)
mqm@aztlan1.fyre.ibm.com: /var/mqm
$ amqsput Q2 QM910
Sample AMQSPUT0 start
target queue is Q2
testing explicit queue manager
Sample AMQSPUT0 end
+++ end +++

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
21 February 2020

UID

ibm13257307