Chapter 4 . Managing the MessageQ MQSeries Connection Environment

This chapter describes how to manage the MessageQ MQSeries Connection environment. It covers the following tasks:


Starting the Queue Message Bridge

Before you can start the QMB, set the MessageQ environment variables for the MessageQ bus and group to which the QMB will attach. Then, you can start the QMB processes.

To start the QMB processes, you must run the qmbsrv image and pass the required command parameters. You can do this in the form of a command file or directly from an interactive session. Remember that for the bridge to function correctly, you must have at least one QMBDM and QMBMD.

The command syntax for the QMB program is as follows:

qmbsrv -d msg-direction   -s server-type   -n mgr-name 
-
r reply-qname -m memory-name -c pathname
-l pathname -a number -i interval
[-e] [-t]

Table 4-1 describes the QMB command parameters.
Table 4-1 Queue Message Bridge Command Parameters

Parameter Description

-d msg-direction

Specifies the direction in which messages flow. You must specify one of the following parameters:

-s server-type

Defines the QMB server type, which can be either PERMANENT or TEMPORARY. However, there must be at least one PERMANENT QMBDM and QMBMD in a QMB server set.

-n mgr-name

Specifies the name of the MQSeries queue manager to which the QMB connects. The mgr-name specified must be the same for all QMB instances in the set. This parameter is passed as an ASCII string.

-r reply-name

Specifies the name of the reply queue. The QMB prefixes the name with either DMQ_ or MQS_ to create a full name. This queue must be defined as a permanent queue on the messaging system. The reply_name must be the same for all QMB instances in the set.

This parameter is passed as an ASCII string.

-m memory-name

Specifies the shared memory name. This name is assigned to the shared memory and semaphore required by the QMB. Used in the CI to MQSeries queue name resolution. The name has a _SEM or _SHM appended to it.

The memory-name specified must be the same for all QMB instances in the set. This parameter is passed as an ASCII string.

-c pathname

Specifies the full pathname of the QMB configuration file

-l pathname

Specifies the full pathname of the QMB log file

-a number

Specifies the maximum number of active (reply pending from MessageQ servers) MQSeries clients. The number specified must be the same for all QMB instances in the set. The maximum value is 1000.

-i interval

Specifies the connection index (CI) purge interval (in seconds) for replies pending originating from MessageQ and going to an MQSeries client.

The interval specified must be the same for all QMB instances in the set.

-e

Specifies event logging. This parameter is optional.

-t

Specifies trace logging. This parameter is optional.

Note that the -e and -t parameters generate a fair amount of information in your log files. These parameters should not be left on for extended periods.

To start the permanent QMB process, enter the following commands:

qmbsrv  -d QMBDM  -s PERMANENT  -n MQMNAME  -r DMC_REPLYQ
-m SHMNAME -c /usr/qmb/qmbprod1.cfg
-l /usr/qmb/qmbdm.log -a 60 -i 100
qmbsrv  -d QMBMD  -s PERMANENT -n MQMNAME -r DMC_REPLYQ
-m SHMNAME -c /usr/qmb/qmbprod1.cfg
-l /usr/qmb/qmbmd.log -a 60 -i 100

Note: Permanent QMBDM and QMBMD processes must be executing before any message exchange can occur. These processes register interest in each other and only allow message exchange if both are active.

To add an additional QMBMD server (in which messages flow from MQSeries to MessageQ), enter the following command:

qmbsrv  -d QMBMD  -s TEMPORARY  -n MQMNAME  -r DMC_REPLYQ
-m SHMNAME -c /usr/qmb/qmbprod2.cfg
-l /usr/qmb/qmbmd.log -a 60 -i 100

You can use a different configuration file (qmbprod2.cfg) to allow specific queues to be serviced by this copy of the QMB. Using a different configuration file gives you an additional level of customization and tuning.

Performance Considerations

You can maximize the performance of the MQSeries to MessageQ connection. To do so, add a temporary QMBMD process with a configuration file designed to service a specific MQSeries LSQ. The required permanent QMBMD process polls in a round-robin fashion all MQSeries LSQs for input. You can force a temporary QMBMD process to service a subset or single LSQ or REPLYQ by specifying a tailored configuration file with the -c parameter at startup. The rules that determine the way a temporary QMBMD process services its LSQs are as follows:


Stopping the Queue Message Bridge

You can stop the QMB processes in the following ways:


Using the MessageQ Monitor Utility

To troubleshoot the MessageQ performance problems, use the MessageQ Monitor utility. You can use this utility to determine the status of the queues, cross-group connections, attached programs, and other information. You can also use it to determine if the messages are flowing correctly by monitoring queue detail information of the queues involved.


Using the runmqsc MQSeries Utility

Use the runmqsc MQSeries utility to determine the state and status of the MQSeries components used by the QMB. You can use the runmqsc utility as follows:

See the MQSeries Command Reference Manual for a complete list of valid commands.


Troubleshooting MessageQ MQSeries Connection Problems

To troubleshoot problems with MessageQ MQSeries Connection, view the log files produced by MessageQ, the QMB, and MQSeries applications. Typically, these log files also contain important information about successful and unsuccessful system events.

Note that the most efficient way to troubleshoot message queuing applications is to follow the queues used by the application. Start by making sure you are familiar with the flow of messages in your application as the message goes from queue to queue. Use the tools available on each platform to determine and follow the message flow. The most common approach is to use message counts and queue depths to follow the message.

Queue Message Bridge Log Files

You can view the QMB log files to troubleshoot your messaging application. The QMB produces log files that provide the following information:

The QMB program logs events and errors to the log defined at startup with the -l command parameter. For a more detailed log file, there are two additional command parameters that you can use:

Logging generates a fair amount of information; do not leave it on for extended periods of time. Trace logging is generally used to follow message flow. Event logging is used for problem determination.

Listing 4-1 shows a QMBDM log file created with the -t parameter.

Listing 4-1 QMBDM Log File
QMB: Mar 15 11:20:07 Version: 3.20 for AIX
QMB: Mar 15 11:20:07 MQS Client Maximum Active : 100
QMB: Mar 15 11:20:07 MQS Client Inactivity Timer: 60
SEM: Mar 15 11:20:07 Create: QMB_SHM_SEM
SEM: Mar 15 11:20:07 CREATE: /var/tmp/dmq/QMB_SHM_SEM Atchd:1 Locked: 0
MMF: Mar 15 11:20:07 CREATE: /var/tmp/dmq/QMB_SHM Sz:20480 Add: 805306368
MMF: Mar 15 11:20:07 Mapped: /var/tmp/dmq/QMB_SHM_MMF Sz:20480 Add: 805306368
MQS: Mar 15 11:20:07 CONN QMGR: QMGR_DWO_01 Hconn: 537500008
DMQ: Mar 15 11:20:07 Attach - Queue Number : 2.8
QMB: Mar 15 11:20:07 QMB DIRECTION is QMBDM
MQS: Mar 15 11:20:07 MQS Reply Queue: MQS_REPLYQ
DMQ: Mar 15 11:20:07 DMQ Reply Queue: DMQ_REPLYQ MRQ Address:'2.7'

QMB: Mar 15 11:20:07 QTBL DMQ LSQ COUNT: 4 MSQ LSQ COUNT: 2

QMB: Mar 15 11:20:07 SEL_MASK 537506120 Que: 0
QMB: Mar 15 11:20:07 SEL_MASK 537506172 Que: 7
.
.
.
DMQ: Mar 15 11:20:07 AVAIL REGISTRATION SUCCESS
DMQ: Mar 15 11:20:08 GET Q: 8 src: 2.99 cl: 29 ty: -1184 l: 4 e: 1
DMQ: Mar 15 11:20:07 QMB PROCESS UNAVAILABLE '2.9'

DMQ: Mar 15 11:20:14 GET Q: 8 src: 2.99 cl: 29 ty: -1183 l: 4 e: 1
DMQ: Mar 15 11:20:07 QMB PROCESS AVAILABLE '2.9'

DMQ: Mar 15 11:21:23 GET Q: 16 src: 2.222 cl: 32000 ty: -5010 l: 60 e: 1
MQS: Mar 15 11:21:23 OPEN QUEUE: MQS_REMOTE Hobj: 537433704
MQS: Mar 15 11:21:23 SEND RSQ: MQS_REMOTE Sz: 60 Per: 0 Msg: 0
DMQ: Mar 15 11:22:04 GET Q: 16 src: 2.223 cl: 32000 ty: -5010 l: 60 e: 1
MQS: Mar 15 11:22:04 SEND RSQ: MQS_REMOTE Sz: 60 Per: 0 Msg: 0
.
.
.
MQS: Mar 15 11:23:00 PUT1 Q: RSQ_15 Sz: 60 Per: 0 Msg: MQS_CLIENT
QMB: Mar 15 11:23:29 Start EXIT_HANDLER PROCESSING

QMB: Mar 15 11:23:29 TERMINATE PROGRAM SIGNAL (SIGTERM)

MMF: Mar 15 11:23:29 WRITE : /var/tmp/dmq/QMB_SHM_MMF Bytes: 20480
MMF: Mar 15 11:23:29 Close : /var/tmp/dmq/QMB_SHM_MMF
SEM: Mar 15 11:23:29 DELETE: /var/tmp/dmq/QMB_SHM_SEM
MMF: Mar 15 11:23:29 DELETE: /var/tmp/dmq/QMB_SHM Sz:20480 Add: 805306368
MQS: Mar 15 11:23:29 CONN QMGR: QMGR_DWO_01 Disconnect Complete


MQSeries Log Files

You can use the MQSeries log files to determine any failures or events associated with the various components. Here is how to locate the MQSeries log files:


Using the MessageQ MQSeries Connection Utility

On your distribution kit, MessageQ MQSeries Connection provides the source and makefile for an example utility that facilitates the sending of control messages to the QMB processes. This utility allows you to control the behavior of a target QMB process, without having to close the process or rewrite the client or server application to send the desired control message to the QMB process.

The MessageQ MQSeries Connection utility is called dmc_util. Before you can use this utility, you must create the executable using the makefile provided. The source file (dmc_util.c) and the makefile (dmc_util.mak) for this utility are located in the /usr/kits/DMC32B/examples (or /usr/kits/DMC32C/examples) directory.

Note that you can modify the dmc_util source file to better meet the needs of your project. If you do this, copy the source and makefile to your working directory before you make any modifications.

How the MessageQ MQSeries Connection Utility Works

The dmc_util sends a message containing the appropriate MessageQ class and message type to perform the desired control function. In most cases, this message is sent to the QMB primary queue.

Table 4-2 describes the valid control functions by message type.
Table 4-2 Valid Control Functions by Message Type

Message Type Description

MSG_TYPE_PURGE_CI

Purges all nonpersistent connection index (CI) from the CI table

MSG_TYPE_PURGE_CI_ALL

Purges all CIs from the CI table

MSG_TYPE_NEW_LOG

Closes the existing log and opens a new log

MSG_TYPE_LOAD_CONFIG

Reloads the QMB configuration

MSG_TYPE_RSQ_REGISTER

Requires the RSQ registration structure in the message body of the message structure

MSG_TYPE_EVENT_LOG

Toggles internal event logging. If event logging is on (you started the QMB with the -e parameter), use this message type to toggle event logging off. Likewise, if event logging is off, use this message type to toggle event logging on.

MSG_TYPE_TRACE_TYPE

Toggles internal trace logging. If trace logging is on (you started the QMB with the -t parameter), use this message type to toggle trace logging off. Likewise, if trace logging is off, use this message type to toggle trace logging on.

MSG_TYPE_TERMINATE

Terminates all QMB processes

The dmc_util sends most control messages to the QMBDM primary queue (which is also the default target [QMBDM] ). However, some control messages work on a specific QMBDM or QMBMD process and must be directed to that process' group and queue. For example, you can terminate a specific temporary QMB process without terminating the permanent process.

The dmc_util allows you to change the target group and queue so that control messages can be sent to queues other than the QMBDM primary queue (the default target).

Starting the MessageQ MQSeries Connection Utility

Before you can run the dmc_util, you must make the executable file. Also, you must set the DMQ_BUS_ID and DMQ_GROUP_ID environment variables. Then, you can run the dmc_util by entering the following command:

% dmc_util

The dmc_util displays a main menu as shown in Listing 4-2.

Listing 4-2 The dmc_util Main Menu
        MessageQ MQSeries Connection Utility (V3.2)

1) Toggle the QMB event log switch (MSG_TYPE_EVENT_LOG)
2) Toggle the QMB trace log switch (MSG_TYPE_TRACE_LOG)
3) Force load of QMB config file (MSG_TYPE_LOAD_CONFIG)
4) Close old and open new log file (MSG_TYPE_NEW_LOG)
5) Purge non-persistent CI only (MSG_TYPE_PURGE_CI)
6) Purge all CI (MSG_TYPE_PURGE_CI_ALL)
7) Dump MQMD to Log File (MSG_TYPE_DUMP_QTABLES)
8) Dynamic Service Registration (MSG_TYPE_RSQ_REGISTER)
9) Terminate the QMB processes (MSG_TYPE_TERMINATE)

10) Change target group and queue
11) Set target group and queue to default [QMBDM] primary
12) Exit this utility

Default Target [QMBDM] 5.12
Current Target Default [QMBDM] 5.12

Enter Message Choice:

Note the group.queue (5.12) number in the current target field at the bottom of the main menu. It is to this target that control messages are sent. See the Understanding Current and Default Target Groups and Queues topic for more information.

Understanding Current and Default Target Groups and Queues

After you invoke dmc_util, it displays the default target line at the bottom of the main menu. The default target line display differs depending on whether or not the target was located when the dmc_util was started. Table 4-3 describes the target line display.
Table 4-3 Target Line Display

Display from Main Menu Description

Default Target [QMBDM] G.Q

The target was located during startup. (G.Q indicates a valid group and queue number such as 5.12.)

Default Target [QMBDM] UNDEFINED

The dmc_util could not locate the QMBDM process.

Current Target Default [QMBDM] G.Q

The default target was located during start up. (G.Q indicates a valid group and queue number such as 5.12.)

Current Target Group : [UNDEFINED]
Queue : [UNDEFINED]

The dmc_util could not locate the current target.

After dmc_util is started, the current target maybe changed to any group.queue using the menu message choice 10 (change target group and queue).

After you enter a new target group and queue, the dmc_util displays a message similar to the following:

Current Target Group : [x] Queue : [x]

Note that it is this current target group that dmc_util control messages are sent to. Control messages must be sent to their proper target for the desired QMB action to take place.

Most of the dmc_util control messages just need a target and message type in order to complete the requested action. There are some control messages, which require some additional information, and the dmc_util prompts for this information.

Selecting the Terminate QMB Process Message Choice

You can select message choice 9 to terminate the QMB process that you specify. If you select this message choice, the menu shown in Listing 4-3 will appear:

Listing 4-3 Terminate Queue Message Bridge Process Menu
1) Terminate QMBDM & all temporary instances  (MessageQ to MQSeries)
2) Terminate QMBMD & all temporary instances (MQSeries to MessageQ)
3) Terminate a single temporary QMB instance (DMQ Address required)
4) Terminate QMBDM, QMBMD and all temporary instances (Bridge Set)

Select terminate choice or <CR> to exit:

Selecting the Dynamic Service Registration Message Choice

You can change the registration of a queue using the Dynamic Service Registration message choice (8). When you select this message choice to change the MessageQ RSQ, the dialog as shown in Listing 4-4 will appear:

Listing 4-4 Dynamic Service Registration for a MessageQ RSQ
Enter LSQ name to assign the RSQ to:  
Enter LSQ Owner (M or D):
Enter RSQ MessageQ Queue Address
Enter group number:
Enter queue number:

When you select this message choice to change the MQSeries RSQ, the dialog as shown in Listing 4-5 will appear:

Listing 4-5 Dynamic Service Registration for an MQSeries RSQ
Enter LSQ name to assign the RSQ to: 
Enter LSQ Owner (M or D):
Enter MQSeries queue name of RSQ:

See the Registering Remote Service Queues topic for more information.

Selecting the Close Old and Open New Log File Message Choice

Message choice 4 (Close old and open new log file) in the main menu closes the current target (QMBDM and QMBMD) and opens a new log file. The new log file has the same name as the old log file except that the new one has a tilde (~) appended to the end. For example, if the current log file name is dmc_dm.log, this message choice causes the log file to be closed and the dmc_dm.log~ to be created. Subsequent invocations of this message choice causes another tilde to be appended to the end of the file name. In this case, dmc_dm.log~~ will be created.

Exiting the MessageQ MQSeries Connection Utility

To exit the dmc_util, select message choice 12 (exit this utility).