Setting up a remote queue manager to use with the messaging REST API
You can use the messaging REST API to connect to remote queue managers for messaging. Before you can connect to a remote queue manager, you must set up the remote queue manager configuration. Then, you can connect to the remote queue manager 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. TheMQWebAdmin
andMQWebAdminRO
roles are not applicable for the messaging REST API.- If mqRestMessagingAdoptWebUserContext is set to
true
in the mqweb server configuration, the users in theMQWebUser
role must be authorized to access queues and topics that are used for messaging through OAM or RACF®. - If mqRestMessagingAdoptWebUserContext is set to
false
in the mqweb server configuration, the user ID that is used to start the mqweb server must be authorized to access queues and topics that are used for messaging through OAM or RACF.
- If mqRestMessagingAdoptWebUserContext is set to
- 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
You can connect to remote queue managers by using the messaging REST API. A remote queue manager can be a queue manager on another system, a queue manager in another installation, or a queue manager in the same installation as the mqweb server.
To connect to a remote queue manager, you must complete the following configuration steps:
- Configure a server-connection channel and a listener.
- Give authority to an appropriate user to access the queue manager.
- Create a CCDT file that contains the connection information for the queue manager.
- Add the connection information to the messaging REST API by using the setmqweb remote command.
You can also configure your remote queue managers as part of a queue manager group. For more information, see Setting up a queue manager group to use with the messaging REST API.
Procedure
Results
Example
- On the system where the remote queue manager QM1 is, a server-connection channel and a listener
are created. The listener is started, and authorization is given for user
exampleUser
to connect to the queue manager and access a queue that is used for messaging:runmqsc QM1 #Define the server connection channel that will accept connections from the Console DEFINE CHANNEL(QM1.SVRCONN) CHLTYPE(SVRCONN) TRPTYPE(TCP) # Define the listener to use for the connection from the Console DEFINE LISTENER(REMOTE.LISTENER) TRPTYPE(TCP) PORT(1414) # Start the listener START LISTENER(REMOTE.LISTENER) end #Set mq authorization for exampleUser to access the queue manager and a queue for messaging setmqaut -m QM1 -t qmgr -p exampleUser +connect +inq +setall +dsp setmqaut -m QM1 -t queue -p exampleUser -n EXAMPLEQ +put +get +browse +inq
- On the system where the mqweb server is running, a QM1_ccdt.json file is
created with the following connection information:
{ "channel": [{ "name": "QM1.SVRCONN", "clientConnection": { "connection": [{ "host": "example.com", "port": 1414 }], "queueManager": "QM1" }, "type": "clientConnection" }] }
- On the system where the mqweb server is running, the connection information for queue manager
QM1 is added to the mqweb server. The credentials for
exampleUser
are included in the connection information:setmqweb remote add -uniqueName "MACHINEAQM1" -qmgrName "QM1" -ccdtURL "c:\myccdts\QM1_ccdt.json" -username "exampleUser" -password "password"
- The messaging REST API can connect to the remote queue
manager QM1 by using the unique name for the queue manager connection in place of the queue manager
name in the resource URL:
curl -k https://localhost:9443/ibmmq/rest/v2/messaging/qmgr/MACHINEAQM1/queue/EXAMPLEQ/message -X POST -u myuser:mypassword -H "ibm-mq-rest-csrf-token: value" -H "Content-Type: text/plain;charset=utf-8" --data "Hello World!"