Before you can put a message on a remote queue, you will need two queue managers, where one queue manager will be on the machine that is sending the message, and the other queue manager is on the machine that is receiving the message. The sender should have a local transmission queue and a remote queue definition, and the receiver should have a remote queue. There should also be a server connection channel between machine 1 (the sender) and machine 2 (the receiver).
If the client machine is Windows
- Open the Control Panel.
- Select System.
- Select the Advanced tab.
- Select the Environment Variables button.
- In the User Variables pane, select New.
- Enter the following:
- Name = MQSERVER
- Type CLIENT.<remote queue manager name>/TCP/<mq server hostname>(port). For example: CLIENT.MANAGER02/TCP/mq.example.com(1414)
- Select OK.
If the client machine is Linux
Change to the user account that is used to connect to the MQ Server. For example, let's say John Doe's account is used to connect to the MQ Server.
~]# cd JohnDoe
Add the following to the end of the /home/<username>/.bash_profile file. For example: CLIENT.MANAGER02/TCP/mq.example.com(1414)
MQSERVER=CLIENT.<remote queue manager name>/TCP/<mq server hostname>(port)
Use the amqsput command to put a message onto a remote queue.
amqsput QUEUE01 MANAGER01 Sample amqsput0 start target queue is QUEUE01
Enter some text, and press enter twice.
This is a test