Creating a message channel

Before you begin

Before creating a message channel, you must already have completed the following tasks in this tutorial:

About this task

In this part of the tutorial, you will create a message channel between the sending and receiving queue managers.

Creating the message channel using MQ Explorer

Procedure

  1. On the receiving queue manager QM_APPLE, create the receiver end of the channel:
    1. In the Navigator view, expand the queue manager QM_APPLE that you created earlier.
    2. Right-click the Channels folder, then click New > Receiver Channel.
      The New Receiver Channel wizard opens.
    3. In the Name field, type QM_ORANGE.QM_APPLE
    4. Click Finish.
      You have now created the receiver channel on the receiving machine.
  2. On the sending queue manager QM_ORANGE, create the sender end of the channel:
    1. Expand the queue manager QM_ORANGE that you created earlier.
    2. Right-click the Channels folder, then click New > Sender Channel.
      The New Sender Channel wizard opens.
    3. In the Name field, type QM_ORANGE.QM_APPLE, then click Next.
    4. In the Connection name field, type the computer name or IP address of the receiving machine (you should already have obtained this with your 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.
    5. 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 Creating the queues on the sending queue manager.
    6. Click Finish.
    7. Click the Channels folder.
    8. Right-click QM_ORANGE.QM_APPLE.
    9. From the pop-up menu, click Start.
    10. Click OK.
      You 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

You 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. You have also started the sender channel, which automatically started the receiver channel.

Creating the message channel using MQSC

Procedure

  1. Open a command prompt on the receiving machine and follow these steps:
    1. Start MQSC by typing the command:
      runmqsc
      A message tells you that an MQSC session has started.
    2. 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.
    3. 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; you 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 your 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.

    4. Verification requires you to start the default IBM WebSphere 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 you can proceed to step e. If you 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.
    5. In the MQSC window, start the default IBM WebSphere MQ listener by entering the following command:
      start listener(system.default.listener.tcp)
    6. Stop MQSC by typing:
      end
      Some messages are displayed followed by the command prompt.
  2. Open a command prompt on the sending machine and follow these steps:
    1. Start MQSC by typing the command:
      runmqsc
      A message tells you that an MQSC session has started.
    2. 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.
    3. Start the channel by typing the following command:
      start channel (QM_ORANGE.QM_APPLE)
    4. Stop MQSC by typing:
      end
      Some messages are displayed followed by the command prompt.

Results

You have now created all the IBM WebSphere 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.