How to Administrate Websphere MQ Channels ?

Websphere MQ Channel Arministration:

Now we gona see how to define, stop, start, and display the status of WebSphere MQ Channels. For each local Queue Manager, we need a Sender Channel and a Receiver Channel, both of which need a matching pair on a remote Queue Manager.

How to define a Channel?

In the following figure, on the left-hand side, we are on QMA and define two Channels:

·         A Sender Channel called QMA.TO.QMB, which uses the Transmission Queue QMB.XMITQ and points to the remote WebSphere MQ system at IP address 127.0.0.1, which is listening on port number1451 (which is QMB).
·         A Receiver Channel called QMB.TO.QMA, which is used to receive messages (from QMB in this case).
There are corresponding Sender and Receiver Channels defned on QMB. Note that the pair of Sender and Receiver Channel names on both QMA and QMB must be the same, so the Receiver Channel on QMB must have the same name as the Sender Channel on QMA.

MQ Listener, Channel and Queue Management

How to start a Channel?

There are four ways of starting a Channel, the choice depending on your site standards. The following examples are for the Sender Channel QMA.TO.QMB, defined on QMA. Note that we always start a Sender Channel, never a Receiver Channel.

·         By issuing the RUNMQCHL MQ command on QMA: Using the RUNMQCHL MQ command, shown next (which can be stored in a file called SYSA_QMA_START_RUNMQCHL_AB.BAT):

start runmqchl -m QMA -c QMA.TO.QMB

·         By issuing the START CHANNEL MQSC command on QMA: We can use the START CHANNELMQSC command on QMA as follows:

: start channel(QMA.TO.QMB)

·         By defining and starting a Service: A Service is used to define the user programs that are to be started and stopped when a Queue Manager is started and stopped. We can start a Channel by defning an MQ Service for it and then starting the Service. So let's defne a Service called STSYSACH, to start the Sender Channel QMA.TO.QMB defned on Queue Manager QMA. The Service calls the program RUNMQCHL, and we know what the parameters for this program are, because we covered them in the frst method. These values are passed to the command through the STARTARGparameter. The DEFINE SERVICE MQSC command is:

: DEFINE SERVICE(STSYSACH) +
CONTROL(QMGR) +
SERVTYPE(COMMAND) +
STARTARG('-c QMA.TO.QMB -m QMA') +
STARTCMD(RUNMQCHL)

Once the service has been defined, we need to start it, using the START SERVICE MQSC command on QMA:

: start service(STSYSACH)

·         As part of the Transmission Queue definition: We may not want the Channel to be continuously active, and only want it activated when there is a message to process. In this situation, we can initiate a Channel start when the Transmission Queue is used.

How to display a list of Channels?

We use the DISPLAY CHANNEL MQSC command to list out the Channels for a Queue Manager:

: dis channel(*) 

How to check/display the status of a Channel?

To check that a Channel is running, issue the DISPLAY CHSTATUS MQSC command:

: dis chstatus(*)
AMQ8417: Display Channel Status details.
  CHANNEL(QMA.TO.QMB)                  CHLTYPE(SDR)
  CONNAME(127.0.0.1(1450))                 CURRENT
  RQMNAME( )                                         STATUS(RUNNING)
  SUBSTATE( )                      XMITQ(QMB.XMITQ)

We are looking for a status of RUNNING

How to stop a Channel?

As an example, let's say we want to stop the Sender Channel QMB.TO.QMA defined on QMB. We can stop it by using the STOP CHANNEL MQSC command:

$ runmqsc QMB
: stop channel(QMB.TO.QMA)
       1 : stop channel(QMB.TO.QMA)
AMQ8019: Stop WebSphere MQ Channel accepted.

If we now display the Channels, we can see that the QMB.TO.QMA Channel has a status of STOPPED.

: dis chstatus(*)
       2 : dis chstatus(*)

AMQ8417: Display Channel Status details.
  CHANNEL(QMA.TO.QMB)                  CHLTYPE(RCVR)
  CONNAME(127.0.0.1)       CURRENT
  RQMNAME(QMA)                                STATUS(RUNNING)
  SUBSTATE(RECEIVE)
AMQ8417: Display Channel Status details.
  CHANNEL(QMB.TO.QMA)                  CHLTYPE(SDR)
  CONNAME(127.0.0.1 (1450))                CURRENT
  RQMNAME(QMA)                                STATUS(STOPPED)
  SUBSTATE( )                      XMITQ(QMA.XMITQ)


Comments