IBM Support

How to identify MQ client connections and stop them

White Papers


Abstract

MQ client applications can connect to a queue manager through a transport type of "client", instead of "bindings". WebSphere MQ runmqsc, MQ Explorer and SupportPac MS6B (chstat script) can be set to identify connections of this type, and stop them. To learn how to configure these options, use the information in this note and in the attached PDF document.

Content

The processes described here have been tested with the following configurations:
1: An MQ JMS client, used by WebSphere Application Server, with the automatic client reconnect option enabled.
2: The amqsputc sample MQ application, with the automatic client reconnect option disabled.
3: The amqsphac high availability put sample MQ application, with the automatic client reconnect option enabled.
4: MQ Explorer, with the automatic client reconnect option disabled.

If you already have some knowledge and experience in this area, here is a set of example commands for using runmqsc to identify MQ client connections and stop them:

- To display all the connections (both bindings and client), use:
display qmstatus conns

- To display the client applications using a server-connection channel:
display conn(*) where(channel NE '') APPLTAG CHANNEL CONNAME CONNOPTS

- To stop a connection (using the desired connection number from "display conn(*)"):
stop conn(connectionNumberfromDisplayConn)

- To stop a server-connection channel and allow it to be restarted by new connections:
stop channel(channelName) status(INACTIVE)

- To stop a server-connection channel and force it to remain stopped:
stop channel(channelName) status(STOPPED)

++ Displaying how many channels are in use (Updated on 14-Dec-2018)

The following excerpt is from:
http://www-01.ibm.com/support/docview.wss?uid=swg21449463
Finding the number of running channels

To display all the channels, use:

Windows: you can enter the following compound commands.
Ensure to replace QMGR with the proper values for your system:

echo DISPLAY CHSTATUS(*) | runmqsc QMGR | find /c "AMQ8417"

UNIX: you can enter the following compound commands.
Ensure to replace QMGR with the proper values for your system:

echo "DISPLAY CHSTATUS(*)" | runmqsc QMGR | grep 'AMQ8417' | wc -l

For UNIX: One possible way to apply this information is to create a cron job that issues the mentioned command and if the number of running channels is getting closer to the MaxChannels, then an MQ Administrator might be notified. The following technote could be used as a reference for creating a cron job:
http://www-01.ibm.com/support/docview.wss?uid=swg21249309
    cron job for clearing all messages from a queue

On Distributed platforms the default value for MaxChannels is 100.

A system that is busy serving connections from the network might need a higher number than the default setting. Determine the value that is correct for your environment, ideally by observing the behavior of your system during testing.

On Distributed platforms, MaxChannels is an attribute in the qm.ini file.
The value for MaxChannels must be in the range 1 through 65535, with a default value of 100.

Example on how to change the maximum channels for a queue manager from the default 100 to 300:

Step 1: Modify the qm.ini of the queue manager:
CHANNELS:
   MaxChannels=300

Step 2: Stop and restart the queue manager for the change in the qm.ini to take effect.


++ For a more complete picture, see the attached PDF document. This document has the following contents:
- Chapter 1: Identifying the clients that are connected through channels from the MQ Explorer
- Chapter 2: Identifying the clients that are connected through channels from runmqsc: DISPLAY
CONN(*) where(channel NE '')
- Chapter 3: Identifying the clients that are connected through channels, using 'chstat' from
SupportPac MS6B
- Chapter 4: Stopping a connection through MQ Explorer
- Chapter 5: Stopping a connection through runmqsc: STOP CONN
+ Scenario 1: Stopping a connection from a client that is not using automatic client
reconnect.
+ Scenario 2: Trying to stop a connection from a client that is using automatic client
reconnect.
- Chapter 6: Stopping a connection through runmqsc: STOP CHANNEL STATUS(STOPPED)
+ Scenario 1: Stopping a channel and specifying STATUS(INACTIVE)
+ Scenario 2: Stopping a channel and specifying STATUS(STOPPED)


How to identify MQ client connections and stop them_0.pdf

 


 

Original Publication Date

2015-05-12

Document information

More support for: WebSphere MQ

Component: Channels LU62 / TCP

Software version: 7.0.1, 7.1, 7.5, 8.0

Operating system(s): AIX, HP-UX, Linux, Solaris, Windows

Reference #: 7045669

Modified date: 14 December 2018