Using CCDT For MQ Queue Manager Groups
Using CCDT For MQ Queue Manager Groups
The objective of this techdoc is to show an example of how to define and use a Client
Channel Definition Table (CCDT) in WebSphere MQ V7 (and later versions) for a Queue
Manager Group.
Scenario 1 - Simplest case, using same QMNAME for a single queue manager
(QM3 in host1)
Scenario 2 - Simplest case, using same QMNAME for a single queue manager
(QM3 in another host: host2)
Scenario 3 - Queue Manager Group: QM1 (no leading asterisk)
Scenario 4 - Queue Manager Group: *QM1 (with leading asterisk)
Scenario 5 - Queue Manager Group: ' ' (1 blank character)
Scenario 6 - Queue Manager Group: QMGROUP1
Scenario 7 - Multi-Instance Queue Manager
Page 2 of 49
Notes:
1: It is necessary to define 2 channels with the SAME name: one server-connection
channel (SVRCONN) and one client-connection channel (CLNTCONN).
2: The CCDT file is updated ONLY when the client-connection channel is created or
altered.
+ References
http://www.ibm.com/support/docview.wss?uid=swg27024109
Webcast: Using a Client Channel Definition Table (CCDT) in WebSphere MQ V7 for
Queue Manager Groups
The objective of this webcast is to describe in details how to exploit from a client ap-
plication that is using the MQ interface in C or the WebSphere MQ Classes for JMS V7
the connection to multiple queue managers by using an MQ "Client Channel Definition
Table" (CCDT).
Level of Difficulty: Intermediate
Date: 21 February 2012
Some of the scenarios are mentioned in the following section of the online manual for
MQ will be used:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.-
doc/q027490_.htm
IBM MQ > IBM MQ 9.0.x > IBM MQ > Developing applications >
Developing MQI applications with IBM MQ >
Writing client procedural applications >
Running applications in the IBM MQ MQI client environment >
Connecting IBM MQ MQI client applications to queue managers >
Role of the client channel definition table >
Queue manager groups
The following MQ C-code samples are used to exercise the CCDT functionality:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.-
doc/q024200_.htm
IBM MQ > IBM MQ 9.0.x > IBM MQ > Developing applications > Developing MQI applica-
tions with IBM MQ >
Sample IBM MQ procedural programs > Sample procedural programs (platforms except
z/OS) >
The High availability sample programs
Page 3 of 49
“The amqsghac, amqsphac and amqsmhac high availability sample programs use auto-
mated client reconnection to demonstrate recovery following the failure of a queue
manager.
The programs are started from the command line, and can be used in combination to
demonstrate reconnection after the failure of one instance of a multi-instance queue
manager.
Alternatively, you can also use the samples to demonstrate client reconnection to sin-
gle instance queue managers, typically configured into a queue manager group.
“
Only the PUT and GET sample programs are used in this document. Here are more de-
tails on the samples:
Notes:
+ A "queue manager group" is NOT the same as a "queue-sharing group" (which is only
available in MQ on z/OS).
Page 4 of 49
The CCDT was created with the default values for the client-connection channels for
the following attributes:
AFFINITY(PREFERRED)
CLNTWGHT(0)
The default behavior is that there is no connection balancing and that the MQ client
will choose the first channel name that is active from the list of channels in alphabet-
ical order.
If you want to have a certain level of connection balancing, you will need to alter the
following attributes for the channels in the CCDT:
AFFINITY(NONE)
CLNTWGHT(1)
The testing that I did with the altered values showed that there was a rough round
robin of messages received by the active queue managers.
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.-
doc/q027490_.htm
Queue manager groups
Question: Balance client connections across queue managers, with more clients con-
nected to some queue managers than others.
Answer: Define a queue manager group, and set the CLNTWGHT attribute on each
client channel definition to distribute the connections unevenly.
.
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.-
con.doc/q081750_.htm
IBM MQ > IBM MQ 9.0.x > IBM MQ > Reference > Configuration reference > Channel at-
tributes > Channel attributes in alphabetical order >
Client channel weight (CLNTWGHT)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Chapter 1: Introduction to Queue Manager Groups
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
You can define a set of connections in the client channel definition table (CCDT) as a
Queue Manager Group. The set is defined by its entries having the same value of the
QMNAME attribute in their channel definitions. You can connect an application to a
queue manager that is part of a queue manager group.
Some of the reasons for choosing to use a Queue Manager Group are:
* You want to connect a client to any one of a set of queue managers that is running,
to improve availability.
* You want to reconnect a client to the same queue manager it connected to success-
fully last time, but connect to a different queue manager if the connection fails.
* You want to automatically reconnect a client connection to another queue manager
if the connection fails, without writing any client code.
* You want to automatically reconnect a client connection to a different instance of a
multi-instance queue manager if a standby instance takes over, without writing any
client code.
* You want to balance your client connections across a number of queue managers,
with more clients connecting to some queue managers than others.
* You want to spread the reconnection of many client connections over multiple
queue managers and over time, in case the high volume of connections causes a fail-
ure.
* You want to be able to move your queue managers without changing any client ap-
plication code.
* You want to write client application programs that do not need to know queue man-
ager names.
+++ When to use a leading asterisk in the name of the queue manager group
You can connect an application to a queue manager that is part of a queue manager
group, by prefixing the queue manager name on an MQCONN or MQCONNX call with an
asterisk.
When a queue manager group has a single entry and the names of the group and the
entry are the same, then it is ok to only the name of the queue manager and not us-
ing the asterisk as a prefix.
However, when the group has multiple entries or the group name is different than the
single entry, it is necessary to specify the group name with a leading asterisk.
Page 7 of 49
When the queue manager group has multiple entries and when the name of the group
is NOT specified with a leading asterisk, then attempt to connect to the queue man-
ager will fail and a typical return code is 2058 MQRC_Q_MGR_NAME_ERROR.
For example, QM7 is a queue manager group with multiple entries, thus a leading as-
terisk is required; if the asterisk is omitted, then the connection will fail:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Chapter 2: Hierarchy of precedence for the connection methods
+++ Ensuring that the CCDT will be chosen at runtime
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In order to ensure that the MQ client code will use the CCDT it is necessary to disable
some environment variables and stanzas in a configuration file, and enable the proper
environment variables.
Otherwise, you may think during your test that you are using the CCDT but in reality
you might be using the MQSERVER or the mqclient.ini (which have precedence over
the CCDT).
It is important to notice that the connection via a CCDT is not the highest in the hier-
archy of precedence for the connection methods.
2: Using options (MQCNO flags) to the MQCONN MQI call, either hardcoded values or
values passed via input parameters to an application.
If the application does not use hardcoded values in the MQCONN or if no input param-
eters are passed to MQCONN, then the MQ client code will use the following method
(MQSERVER).
If other environment variables are set for the methods below, they are IGNORED if
MQSERVER is defined.
Page 9 of 49
If MQSERVER is not defined, then the MQ client code will use the following method
(mqclient.ini).
CHANNELS:
DefRecon=YES
ServerConnectionParms=SYSTEM.DEF.SVRCONN/TCP/host1(1421)
If the environment variables are set for the CCDT, they are ignored if the Client Con-
figuration file is active and if there is a CHANNELS stanza.
The 2nd default location is the current directory where the application is running.
If the environment variable for the Client Configuration file is not set or if the Client
Configuration file does not have a CHANNELS stanza, then the MQ client code will use
this last method (CCDT).
Unix:
export MQCHLLIB=/var/mqm/qmgrs/<QMgrName>/@ipcc/
Windows:
set MQCHLLIB=C:\var\mqm\Qmgrs\<QMgrName>\@ipcc
Note: The default value for the related environment variable is:
export MQCHLTAB=AMQCLCHL.TAB
Because this name is used in this techdoc, there is no need to explicitly define this
variable.
CHANNELS:
DefRecon=YES
ChannelDefinitionDirectory=C:\temp\mq\test-mqclient.ini\
ChannelDefinitionFile=AMQTEST0.TAB
Let's suppose that you define the MQSERVER environment variable in your profile, but
you want to test a CCDT file.
As mentioned in the previous section, if the MQSERVER variable is defined, then the
CCDT will NOT be used.
You will need to "unset" the MQSERVER variable in order for the CCDT to be used.
This is how you unset the variables:
Unix:
To unset MQSERVER:
unset MQSERVER
unset MQCHLTAB
Windows:
To unset a variable in Windows specify a null string to the variable via “=” and no
text after the equal sign:
set MQSERVER=
Based on the above sections, in order to ensure that the CCDT will be used, it is nec-
essary to do the following:
Unix:
unset MQSERVER
unset MQCLNTCF
export MQCHLLIB=/var/mqm/qmgrs/QMgrName/@ipcc/
Note: the following is only if the name is not the default: AMQCLCHL.TAB
export MQCHLTAB=FILENAME
Windows:
set MQSERVER=
set MQCLNTCF=
set MQCHLLIB=C:\var\mqm\Qmgrs\<QMgrName>\@ipcc
Note: the following is only if the name is not the default: AMQCLCHL.TAB
set MQCHLTAB=FILENAME
2) If there is an mqclient.ini file under the install root directory for MQ, then ensure
that the CHANNELS stanza is commented out by using a # character in the first col-
umn, such as:
# CHANNELS:
# ServerConnectionParms=SYSTEM.DEF.SVRCONN/TCP/host1(1421)
Page 13 of 49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Chapter 3: Configuration of the queue managers
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Host: veracruz.x.com
MQ Fix Pack: 7.0.1.4
Platform: Linux Intel 32-bit, SUSE 11
QMNAME(QM1) PORT: 1431
QMNAME(QM3) PORT: 1423
QMNAME(QMMI1) PORT: 1421
Host: aemtux1.x.com
MQ Fix Pack: 7.0.1.3
Platform: Linux PowerPC 64-bit, SUSE 9
QMNAME(QM1) PORT: 1425
QMNAME(QM4) PORT: 1434
Host: aemaix1.x.com
MQ Fix Pack: 7.0.1.2
Platform: AIX 6.1
QMNAME(QM2) PORT: 1422
QMNAME(QM3) PORT: 1451
Host: cbeech.x.com
Platform: Linux Intel 32-bit, SUSE 11
MQ Fix Pack: 7.0.1.3
QMNAME(QMMI1) PORT: 1421
Page 14 of 49
+ Configuration
Using the general information from the scenarios described earlier, the following ta-
bles were created in order to provide more specific information on the queue man-
agers and channel names.
+ Scenario 1 - Simplest case - using QMNAME (QM3) for queue manager (QM3) in host-1
QM3 QM3 aemaix1 1451 QM3
+ Scenario 2 - Simplest case, using same QMNAME for a single queue manager (QM3 in
another host: host2)
QM3 QM3 veracruz 1423 QM3
Note: For your information, the following file supplied with MQ provides a good exam-
ple of MQSC script:
It is a good idea to capture the output in a file, because you may want to review the
output just in case that there are warnings or errors.
To facilitate the setup of the CCDT, 2 batch command (script) files will be used.
a) ccdt-svrconn.mqsc
This script will be run on EACH queue manager that participates in the scenario.
This will define the Server-Connection (SVRCONN) channels.
Strictly speaking, the same script does not have to be applied to each queue manager
and only the particular channels for that queue manager would need to be applied.
However, for the sake of simplicity in setting up the testing environment, the script
has all the channels for all the queue managers.
b) ccdt-cltconn.mqsc
This script is going to be run ONLY once to actually create the CCDT. This CCDT file
will be copied to other hosts.
This will define the Client-Connection (CLTCONN) channels.
Page 16 of 49
* Scenario 1 - Simplest case - using QMNAME (QM3) for queue manager (QM3) in host-1
DEFINE CHANNEL(QM3) CHLTYPE(SVRCONN) TRPTYPE(TCP) REPLACE
* Scenario 2 - Simplest case - using QMNAME (QM3) for queue manager (QM3) in host-2
* Note: There is no actual change. Using this line for completeness sake.
DEFINE CHANNEL(QM3) CHLTYPE(SVRCONN) TRPTYPE(TCP) REPLACE
* Scenario 1 - Simplest case - using QMNAME (QM3) for queue manager (QM3) in host-1
DEFINE CHANNEL(QM3) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
CONNAME('aemaix1.x.com(1451)') QMNAME(QM3) REPLACE
* Scenario 2 - Simplest case - using QMNAME (QM3) for queue manager (QM3) in host-2
* When running Scenario 1, it is necessary to comment out the following, but uncom-
ment them when running Scenario 2
* DEFINE CHANNEL(QM3) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
* CONNAME('veracruz.x.com(1423)') QMNAME(QM3) REPLACE
++ Run the scripts and browse the output files in case that there were errors.
b) In the client host, run the script to create the client-connection channels
+++ Using the MQ Explorer to verify that the Server Connection channels were proper-
ly created
+++ Using the MQ Explorer to verify that the Client Connection channels were proper-
ly created
Page 21 of 49
++ Using the runmqsc to verify that the Server Connection channels were properly
created
+++ Using the runmqsc to verify that the Client Connection channels were properly
created
The previous tasks using the MQ Explorer and "runmqsc" allow you to display the cre-
ated Client-Connection channels that are known to the queue manager that was used
to define them.
The Client-Connection channels are also stored in the Client Channel Definition Table
(CCDT) of the queue manager, under the file:
AMQCLCHL.TAB
Now you can copy this file into a desired directory in each of the machines where a
client application is going to use the CCDT.
The CCDT file is binary and not text. Thus, when using ftp to transfer the file from
one host to another, you must ensure that you use the mode "binary", otherwise, if it
is transferred as ascii, it may arrive corrupted.
Unix:
Example: the file AMQCLCHL.TAB was placed in /var/mqm
export MQCHLLIB=/var/mqm/
Note: The default value for the related environment variable is:
export MQCHLTAB=AMQCLCHL.TAB
Interesting Problem!
Let's suppose that you are an MQ Administrator and you see a CCDT file that was
copied from another machine: how do you look at the contents of the CCDT file to
verify its contents? (Your company may have several CCDT files with different names
and for different purposes)
http://www.ibm.com/support/docview.wss?uid=swg24007769
MO72: MQSC Client for WebSphere MQ
1) Visit the above web page and download the zip file with the code and the PDF file
for the documentation.
Windows:
C:\MQ-SupportPac\MO72 MQSC Client
Windows:
cd C:\MQ-SupportPac\MO72 MQSC Client\Windows
4) Run the command which uses the default CCDT file name of AMQCLCHL.TAB.
You need to specify the following flags:
-n => run in client mode to access the CCDT
-t full-path-ending-with-slash => Full directory location
NOTICE that you MUST end the string with a directory separator, or slash!
Page 24 of 49
INCORRECT usage:
For example, the last character of the path name is NOT a directory separator
CORRECT usage:
You need to ensure that the end of the path name has a directory separator.
Notice that you get a prompt: >
Linux example:
$ mqsc -n -t /mqexport/701/data/QMMI1/@ipcc/
>
Windows example:
C:\MQ-SupportPac\MO72 MQSC Client, reads CCDT\Windows>
mqsc -n -t C:\var\mqm\Qmgrs\QM_ANGELITO\@ipcc\
>
> end
Page 25 of 49
+++ Copy ccdt-svrconn.mqsc and AMQCLCHL.TAB (CCDT file) into each host
For example, in Linux host "veracruz" there are several queue managers that are in-
volved in some of the scenarios:
The MQSC batch file ccdt-svrconn.mqsc and AMQCLCHL.TAB are copied into /tmp
NOTICE: The CCDT file is a BINARY file and must be copied as BINARY.
If you use FTP you MUST use BINARY, otherwise, if it is transferred as ASCII TEXT then
if the target machine has a different platform, then the file may arrive corrupted.
ftp> quit
221 Goodbye.
Page 26 of 49
+ To run the MQSC command file, issue for each queue manager
rivera@veracruz: /tmp
$ runmqsc QM1 < ccdt-svrconn.mqsc > qm1.out
export MQCHLLIB=/tmp/
Note: The default value for the related environment variable is:
export MQCHLTAB=AMQCLCHL.TAB
+ Run the High-Availability sample programs that put messages and get messages
The sample amqsphac is a high-availability program that does a "put" and exploits ex-
plicitly the automatic reconnect feature introduced in MQ V7.
Note:
In Windows, do not use the single quotes around the queue manager name in
amqsphac:
C:\MQ-doc\techdocs>amqsphac Q9 'QM3'
Sample AMQSPHAC start
MQCONNX ended with reason code 2058
Sample AMQSPHAC end
In Unix, it is OK to use single quotes.
Page 27 of 49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Chapter 4: Description of the Scenarios
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Scenario 1 - Simplest case, using same QMNAME for a single queue manager (QM3 in
host1)
This is the simplest case, and it is a group that has only 1 entry.
The client application passes a queue manager name, QM3, as the QmgrName param-
eter to its MQCONN or MQCONNX MQI call. The WebSphere MQ client code selects the
matching queue manager group, QM3 in Host-1.
The group contains only 1 connection channel, and the WebSphere MQ client tries to
connect to QM3 in host-1 via Channel QM3.
The MQCONN call issued by the client application succeeds when a connection is es-
tablished to QM3.
In this case, the accepted ways to specify the queue manager group are shown.
Note: in Windows do not use single quotes around the queue manager, to avoid the
return code 2058.
Notice that because the group name is the same as the single entry queue manager,
it is OK to not use the asterisk.
The rest of the scenarios will show only one way, the one with leading asterisk:
*GroupName
rivera@veracruz: /home/rivera
(887) amqsphac Q9 'QM3'
Sample AMQSPHAC start
target queue is Q9
message <Message 1>
message <Message 2>
+ Scenario 2 - Simplest case, using same QMNAME for a single queue manager (QM3 in
another host: host2)
If QM3 is moved from Host-1 to Host-2, then only the CCDT needs to be updated to re-
flect the new location of the queue manager:
From: CONNAME('aemaix1.x.com(1451)')
To: CONNAME('veracruz.x.com(1423)')
There is no need to modify the client application, which continues using QM3, regard-
less of its location.
Similar to Scenario 1.
In this scenario, the client application passes a queue manager name, QM1, as the
QmgrName parameter to its MQCONN or MQCONNX MQI call. The WebSphere MQ
client code selects the matching queue manager group, QM1.
The group contains two connection channels, and the WebSphere MQ client tries to
connect to QM1 using each of these channels in turn until it finds an WebSphere MQ
listener for the connection attached to a running queue manager called QM1.
The MQCONN or MQCONNX call issued by the client application succeeds when a con-
nection is established to a running instance of QM1.
Page 32 of 49
The following was issued several times, in order to get a new connection each time.
rivera@veracruz: /home/rivera
(972) amqsghac Q9 QM1
Sample AMQSGHAC start
message <Message 1>
message <Message 2>
Only when QM1 in Veracruz was stopped, then a new connection from the client re-
sulted in messages being delivered to QM1 in aemtux1
"If all applicable channels for a connection have a ClientChannelWeight of zero (the
default) then they are selected in alphabetical order."
Page 33 of 49
In this scenario, the alphabetical order of the channels is QM1.A first, followed by
QM1.B. The default CLNTWGHT(0) is being used in both channels.
CHANNEL(QM1.A) CONNAME('veracruz.x.com(1431)')
CHANNEL(QM1.B) CONNAME('aemtux1.x.com(1425)')
When both queue managers are running the QM1.A channel is always chosen first.
To alter the order, it would be necessary to modify the CLNTWGHT attribute for the
channels, but this is beyond the scope of this techdoc.
Page 34 of 49
This queue manager is actually named QM2 (that is, it is NOT named QM1):
DEFINE CHANNEL(QM1.C) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
CONNAME('aemaix1.x.com(1422)') QMNAME(QM1) REPLACE
Note: The attribute QMNAME in a CLTCONN channel refers to the Queue Manager
Group, and not to actually a single Queue Manager. Thus, the 3rd example shows that
the actual queue manager is QM2 but QMNAME is QM1.
manager called QM1. If your client application prefixes its QmgrName parameter with
an asterisk then any queue manager is a possible connection target.
In this case the MQCONN or MQCONNX calls issued by the client application succeed
when a connection is established to a running instance of either QM1 or QM2.
The name of the queue manager that it connects to does not matter.
The rule for the order of making connection attempts is the same as before. The only
difference is that by prefixing the queue manager name with an asterisk, the client
indicates that the name of the queue manager is not relevant.
The messages are received ONLY at QM1 in veracruz (see explanation in Scenario 3
about choosing the channel name in alphabetical order - the channel name for ver-
acruz is QM1.A and it is first in the list)
rivera@veracruz: /home/rivera
(975) amqsghac Q9 QM1
Sample AMQSGHAC start
message <Message 1>
Page 36 of 49
Stop the QM1 in veracruz, in order to give a chance to the other queue managers to
receive messages.
The messages are received ONLY at QM1 in aemtux1 - the channel name is QM1.B and
it is the 2nd in the list.
^C
Note: The list shown for Scenario 3 has only 2 items, but in reality, for the testing of
this techdoc, the list has 3 items, in order to perform Scenario 4.
In the following example, the queue manager name is specified without a leading as-
terisk.
In this particular run, QM1 in Veracruz and QM1 in aemtux1 are stopped and the only
queue manager running is QM2 in aemaix1. Notice that the connection fails with RC
2058.
In contrast, if the queue manager name is specified with a leading asterisk, then it
works, because the MQ client is being told to NOT care about the actual name of the
queue manager:
There are 3 entries in the CCDT with QMNAME ' ' (1 blank character):
This scenario illustrates use of the default group. In this case the client application
passes an asterisk, '*', or blank ' ', as the QmgrName parameter to its MQCONN or MQ-
CONNX MQI call. By convention in the client channel definition, a blank QMNAME at-
tribute signifies the default queue manager group and either a blank or asterisk Qm-
grName parameter matches a blank QMNAME attribute.
In this example the default queue manager group has client channel connections to
all the queue managers. By selecting the default queue manager group the applica-
tion might be connected to any queue manager in the group.
The MQCONN or MQCONNX call issued by the client application succeeds when a con-
nection is established to a running instance of any queue manager.
Page 39 of 49
Note: The default group is different to a default queue manager, although an applica-
tion uses a blank QmgrName parameter to connect to either the default queue man-
ager group or to the default queue manager. The concept of a default queue manager
group is only relevant to a client application, and a default queue manager to a serv-
er application.
A variation of the Scenario 5 is shown below, in which the application uses an asterisk
'*' instead of a blank.
Important caveats:
- The client is run from Windows. Notice that ONLY one variation is successful (the
one that uses asterisk, the first one in the list below), and the others result in RC
2058.
- The use of ' ' (single space) is suitable for working directly with the MQCONN call,
and not necessarily via samples that interact with the command prompt, such as
amqsphac.
Page 40 of 49
C:\> amqsphac Q9 *
Sample AMQSPHAC start
target queue is Q9
message <Message 1>
message <Message 2>
^C
These other variations fail with code 2058. The failure is due to the parsing of the
command line by the samples, and not by the underlying function of queue manager
groups.
In this case, the messages were received by QM1 in Veracruz, because its channel
name is first in the alphabetical order: DEFAULT.A
rivera@veracruz: /home/rivera
(984) amqsghac Q9 QM1
Sample AMQSGHAC start
message <Message 1>
message <Message 2>
Stop QM1 in Veracruz and resume the test from the client.
C:\> amqsphac Q9 *
Sample AMQSPHAC start
target queue is Q9
message <Message 1>
Page 41 of 49
In this case, the messages are received by QM3 in aemaix1, because its channel name
is next in the alphabetical list, DEFAULT.B, and the previous channel is not opera-
tional.
C:\> amqsphac Q9 *
Sample AMQSPHAC start
target queue is Q9
message <Message 1>
message <Message 2>
In this case, the messages are received by QM4 in aemtux1, because the channel
name DEFAULT.C is the last in the list (and the previous channels are not
operational).
In this scenario, the client application passes a queue manager name prefixed with an
asterisk, *QMGROUP1 as the QmgrName parameter to its MQCONN or MQCONNX MQI
call.
The WebSphere MQ client selects the matching queue manager group, QMGROUP1.
This group contains two client connection channels, and the WebSphere MQ client
tries to connect to any queue manager using each channel in turn. In this example,
the WebSphere MQ client needs to make a successful connection; the name of the
queue manager that it connects to does not matter.
The rule for the order of making connection attempts is the same as before. The only
difference is that by prefixing the queue manager name with an asterisk, the client
indicates that the name of the queue manager is not relevant.
The MQCONN or MQCONNX call issued by the client application succeeds when a con-
nection is established to a running instance of any queue manager connected to by
the channels in the QMGROUP1 queue manager group.
Page 43 of 49
The messages are received only by QM2 in aemaix2 because its channel name is first
in the alphabetical order: QMGROUP1.A
rivera@veracruz: /home/rivera
(991) amqsghac Q9 QM3
Sample AMQSGHAC start
message <Message 1>
message <Message 2>
Page 44 of 49
Notice that because the group name is the same as the single entry queue manager,
it is OK to not use the asterisk.
Do not get confused that there are 2 boxes in the figure for the same queue manager
name (QMMI1), it is still a group with a single entry but for multiple-instances.
That is also the reason for a single definition for the client-connection and server-
connection channel: it is the same queue manager.
Setup: Both instances for QMMI1 are running in veracruz (active) and cbeech (stand-
by).
C:\>amqsphac Q9 QMMI1
Sample AMQSPHAC start
target queue is Q9
message <Message 1>
message <Message 2>
message <Message 3>
The messages are received in veracruz via the sample for high availability get:
Page 45 of 49
rivera@veracruz: /home/rivera/test
$ amqsghac Q9 QMMI1
Sample AMQSGHAC start
message <Message 1>
message <Message 2>
rivera@veracruz: /home/rivera/test
$ endmqm -is QMMI1
Waiting for queue manager 'QMMI1' to end.
WebSphere MQ queue manager 'QMMI1' ending.
WebSphere MQ queue manager 'QMMI1' ended, permitting switchover to a standby
instance.
The sample get is started at the host cbeech while the switchover is happening but it
has not been completed yet. Notice the rc 2538
rivera@cbeech: /home/rivera/test
$ amqsghac Q9 QMMI1
Sample AMQSGHAC start
MQCONNX ended with reason code 2538
Sample AMQSGHAC end
rivera@cbeech: /home/rivera/test
$ amqsghac Q9 QMMI1
Sample AMQSGHAC start
message <Message 26>
message <Message 27>
Notice that the output of the put sample will show the pause while the reconnection
is happening:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Chapter 5: Troubleshooting
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Symptom:
Likely reasons:
a) In Windows, using single quotes around the queue manager group.
b) MQSERVER and mqclient.ini are enabled and thus, in the hierarchy of precedence,
they will be block the usage of the CCDT.
c) The queue manager group has multiple entries.
Actions:
a) In Windows, do not specify the queue manager name with single quotes:
C:\> amqsphac Q9 QM3
Notice that the MQSERVER is set (which means that it will be used first!)
C:\> set mq
MQFT_JAVA_LIB_PATH=C:\Program Files\IBM\WebSphere MQ\java\lib
MQFT_JRE_BIN_PATH=C:\Program Files\IBM\WebSphere MQ\java\jre\bin
MQSERVER=SYSTEM.DEF.SVRCONN/TCP/localhost(1414)
Action:
# CHANNELS:
# DefRecon=YES
# ServerConnectionParms=SYSTEM.DEF.SVRCONN/TCP/localhost(1414)
When the queue manager group has multiple entries and when the name of the group
is NOT specified with a leading asterisk, then the return code 2058 (or other similar
return codes) will be shown:
Symptom:
Likely reason:
The queue manager is stopping and it cannot accept new connections or new re-
quests.
Action:
Ensure that the queue manager is active.
Symptom:
C:\>amqsphac Q9 *QM1
Sample AMQSPHAC start
MQCONNX ended with reason code 2538
Sample AMQSPHAC end
Likely reason:
- The port for the MQ listener is not running
- The queue manager is not running
- The wrong port is specified
- The host name including the domain name is incorrect
Actions:
- Restart the port and/or the queue manager
- Ensure that the port and the hostname are properly specified in the CCDT.
C:\MQ-doc\techdocs>amqsputc Q1 QM3
Sample AMQSPUT0 start
MQCONN ended with reason code 2540
Likely reason:
- The name in the CCDT for the client-connection channel does not have a counter-
part server-connection channel in the target queue manager
Action:
- Create a corresponding server-connection channel in the target queue manager.