Create the message channel using IBM MQ Explorer
Procedure
-
On the receiving queue manager QM_APPLE, create the receiver end of the
channel:
- In the Navigator view, expand the queue manager QM_APPLE that you created earlier.
- Right-click the Channels folder, then click New > Receiver Channel. The New Receiver Channel wizard opens.
- In the Name field, type QM_ORANGE.QM_APPLE
- Click Finish. We have now created the receiver channel on the receiving machine.
-
On the sending queue manager QM_ORANGE, create the sender end of the
channel:
- Expand the queue manager QM_ORANGE that you created earlier.
- Right-click the Channels folder, then click New > Sender Channel. The New Sender Channel wizard opens.
- In the Name field, type QM_ORANGE.QM_APPLE, then click Next.
-
In the Connection name field, type the computer name or IP address of
the receiving machine (we should already have obtained this with the system administrator's
help).
If the default port number 1414 was not used when creating QM_APPLE, the Connection name field
entry should be of the format:
con-name(port)
Where con-name is the computer name or IP address of the receiving machine, and port is the port number used when the receiving queue manager was set up. - In the Transmission queue field, type QM_APPLE The transmission queue name you enter here must match the name you entered for the transmission queue in Create the queues on the sending queue manager.
- Click Finish.
- Click the Channels folder.
- Right-click QM_ORANGE.QM_APPLE.
- From the pop-up menu, click Start.
- Click OK. We have now created the sender channel on the sending machine. Note: You do not have to start the receiver channel because it started automatically when you set up the sender channel (when you set up the sender channel, you specified the receiver channel's IP address).
Results
We have now created a receiver channel QM_ORANGE.QM_APPLE, on the receiving queue manager QM_APPLE, and a sender channel QM_ORANGE.QM_APPLE, on the sending queue manager QM_ORANGE. We have also started the sender channel, which automatically started the receiver channel.Create the message channel using MQSC
Procedure
-
Open a command prompt on the receiving machine and follow these steps:
-
Start MQSC by typing the command:
runmqsc
A message tells you that an MQSC session has started. -
Define a receiving channel by typing the following command:
define channel (QM_ORANGE.QM_APPLE) chltype (RCVR) trptype (TCP)
A message tells you when the channel has been created. -
Open a new command window and check which ports are free. Enter the following command:
netstat -an
This shows you a list of running processes. Check the port number of each of the processes to see if port 1414 is in use; we can find this by looking in the Local Address column. The information is given in the form ip_address:port_being _used.
If port 1414 is not in use, use 1414 as the port number for the listener and sender channel later in the verification. If it is in use, select an alternative port that is not in use; for example 1415 if this is not being used by another process.
-
Verification requires you to start the default IBM MQ listener. By default, the listener will listen on port 1414. If you found that port 1414 was free
in step c, no action is required and we can proceed to step
e. If we must use a port other than 1414, alter the
definition of the SYSTEM.DEFAULT.LISTENER.TCP. For example, to use port 1415, enter the following
command in the MQSC window:
alter listener(system.default.listener.tcp) trptype(tcp) port(port_number)
Where port_number is the number of the port the listener should run on. This must be the same as the number used when defining your sender channel in step 2b of this procedure. -
In the MQSC window, start the default IBM MQ listener by entering the following command:
start listener(system.default.listener.tcp)
-
Stop MQSC by typing:
end
Some messages are displayed followed by the command prompt.
-
Start MQSC by typing the command:
-
Open a command prompt on the sending machine and follow these steps:
- Start MQSC by typing the command: runmqsc A message tells you that an MQSC session has started.
-
Define a sender channel by typing the following command:
define channel(QM_ORANGE.QM_APPLE) chltype(sdr) conname('con-name(port)') xmitq(QM_APPLE) trptype(tcp)
The value con-name is the TCP/IP address of the receiver workstation. The value port is the port on which the listener is running on the receiver machine, the default value is 1414. -
Start the channel by typing the following command:
start channel (QM_ORANGE.QM_APPLE)
-
Stop MQSC by typing:
end
Some messages are displayed followed by the command prompt.
Results
We have now created all the IBM MQ objects required for messages to be sent from the sending queue manager QM_ORANGE to the queue Q1 on the receiving queue manager QM_APPLE. The next task is to send a test message.