You can use the messaging REST API to connect to
queue manager groups for messaging. Before you can connect to a queue manager group, you must set up
the remote queue manager configuration for the group. Then, you can connect to the queue manager
group by using the unique name that is defined in the configuration information.
Before you begin
- Ensure that you configured the mqweb server for use by the administrative REST API, the administrative REST API for MFT, the messaging REST API, or IBM® MQ Console.For more information about configuring the mqweb server with a basic registry, see Basic configuration for the mqweb server.
- If the mqweb server is already configured, ensure that you added the appropriate users to enable
messaging in step 5 of Basic configuration for
the mqweb server. Users of the messaging REST API must
be a member of the
MQWebUser role. The MQWebAdmin and
MQWebAdminRO roles are not applicable for the messaging REST API.
- If mqRestMessagingAdoptWebUserContext is set to
true in
the mqweb server configuration, the users in the MQWebUser role must be authorized
to access queues and topics that are used for messaging. You can authorize these users through OAM
or RACF®.
- If mqRestMessagingAdoptWebUserContext is set to
false in
the mqweb server configuration, the user ID that starts the mqweb server must be authorized to
access queues and topics that are used for messaging. You can authorize this user through OAM or
RACF.
- Ensure that the messaging REST API is configured to
connect to remote queue managers. For more information, see Configuring the connection mode for the messaging REST API
About this task
A queue manager group enables you to connect applications to any queue manager within the group.
The group is defined as a set of connections in a client channel definition table (CCDT). When you
use an MQCONN or an MQCONNX call, you reference the group by prefixing an asterisk to the queue
manager name. With the messaging REST API, you reference the
group by using the unique name that is associated with the queue manager group. The unique name is
included in the resource URL in place of the queue manager name. For more information about queue
manager groups, see Queue manager groups in the CCDT.
You can also configure your remote queue managers individually. For more information, see Setting up a remote queue manager to use with the messaging REST API.
Procedure
-
On each of the remote queue managers in the group, create a server-connection channel to allow
remote connections to the queue manager. You can use the DEFINE CHANNEL MQSC
command on the command line to create server-connection channels.
For example, to
create a server-connection channel
QM1.SVRCONN for queue manager QM1, enter the
following command:
DEFINE CHANNEL(QM1.SVRCONN) CHLTYPE(SVRCONN) TRPTYPE(TCP)
For more information about
DEFINE CHANNEL and the options available, see
DEFINE CHANNEL.
-
On each of the remote queue managers in the group, ensure that an appropriate user is
authorized to access the queue manager. This user must also be authorized to access any queues or
topics that you use for messaging. The user needs
connect,
inquire, alternate user, and set context
authority on the queue manager. On UNIX, Linux®, and Windows use the
setmqaut control command on the command line. On z/OS®, define RACF profiles to give the authorized user access
to the queue manager. For example, on
UNIX, Linux, and Windows, enter the following command to authorize a user,
exampleUser, to access the queue manager QM1:
setmqaut -m QM1 -t qmgr -p exampleUser +connect +inq +altusr +setall
If no listener exists on each of the remote queue
managers in the group, create listeners to accept incoming network connections. You can use the
DEFINE LISTENER MQSC
command on the command line to create listeners. For example, to create a listener
REMOTE.LISTENER on port 1414 for remote queue manager QM1, enter the following
command:
runmqsc QM1
DEFINE LISTENER(REMOTE.LISTENER) TRPTYPE(TCP) PORT(1414)
end
- On each of the remote queue managers in the group, ensure that the
listener is running by using the START
LISTENER MQSC command on the command line.
![[AIX, Linux, Windows]](ngalw.gif)
For example, on
AIX®, Linux, and Windows to start the
listener
REMOTE.LISTENER for queue manager QM1, enter the following
command:
runmqsc QM1
START LISTENER(REMOTE.LISTENER)
end
![[z/OS]](ngzos.gif)
For example, on
z/OS, to start the
listener, enter the following command:
runmqsc QM1
START LISTENER TRPTYPE(TCP) PORT(1414)
end
The channel initiator address space must be started before you can start a listener
on
z/OS.
-
On the system where the mqweb server that hosts the messaging REST API is running, create a JSON CCDT file. This JSON file
contains connection information for each queue manager in the group.
The CCDT file must include the name, clientConnection, and
type information for each queue manager connection. You can optionally include
additional information such as transmissionSecurity information. For more
information about all the CCDT channel attribute definitions, see Complete list of CCDT channel
attribute definitions.
The following example shows a basic JSON CCDT file for two queue manager connections. The first
connection is for queue manager QM1. It has a server connection channel of
QM1.SVRCONN, a listener on port
1414, and runs on host
QM1.example.com. The second connection is for queue manager QM2. It has a server
connection channel of
QM2.SVRCONN, a listener on port
1415, and
runs on host
QM2.example.com. However, as the connections are part of queue
manager group QMGRP, the
queueManager field for both connections is set to the
name of the queue manager group.
{
"channel": [{
"name": "QM1.SVRCONN",
"clientConnection": {
"connection": [{
"host": "QM1.example.com",
"port": 1414
}],
"queueManager": "QMGRP"
},
"type": "clientConnection"
}],
"channel": [{
"name": "QM2.SVRCONN",
"clientConnection": {
"connection": [{
"host": "QM2.example.com",
"port": 1415
}],
"queueManager": "QMGRP"
},
"type": "clientConnection"
}]
}
- From the installation that is running the mqweb server that hosts the
messaging REST API, use the setmqweb
remote command to add the queue manager group to the mqweb server configuration.
As a minimum, you must specify the following parameters:
- -qmgrName, where you specify the group name for the queue manager
group.
- -ccdtURL, where you specify the CCDT URL for the queue managers.
- -uniqueName, where you specify a unique name to identify the queue manager
group.
- -group, to set the queue manager information as being for a group.
You can specify several other options, such as the username and password to use for the
connection, or details of the truststore and keystore. For a full list of parameters that can be
specified with the setmqweb remote command, see setmqweb remote.
For example, to add the queue manager group QMGRP, with the example CCDT file, enter
the following
command:
setmqweb remote add -uniqueName "MyQMGRP" -qmgrName "QMGRP" -ccdtURL "c:\myccdts\group_ccdt.json" -group
Results
The remote queue manager group can be used with the messaging REST API by using the unique name in the resource URL. A
queue manager from the group is selected to complete the request, and information about which queue
manager completed the request is returned in the response header
ibm-mq-resolved-qmgr.