IBM Support

How to auto start and stop a listener in MQ 6.0 and later

Troubleshooting


Problem

You want to minimize the administration of WebSphere MQ listeners. You want them to start and stop automatically when the associated Queue Manager starts and stops. .

Cause

In MQ 5.3 and prior versions, the MQ Listener was not an object directly controlled by the queue manager and additional steps needed to be taken to start/stop the listener.
In MQ 6.0 a new object managed by the queue manager was introduced: Listener

Resolving The Problem

In MQ V6.0 and later you can use the following RUNMQSC command to define a listener that will be started and stopped automatically when the queue manager is started and stopped; this is accomplished by the attribute CONTROL(QMGR).

In this example, the name of the listener is AUTOLISTENER, using TCP/IP in port 1416.

DEFINE LISTENER(AUTOLISTENER) TRPTYPE(TCP) PORT(1416) CONTROL(QMGR) DESCR('Auto start/stop listener')

To start it right away, you can issue the following RUNMQSC command:

START LISTENER(AUTOLISTENER)

Note: the above command can be used to start the listener in case that it is stopped.

To determine its status, you can issue the following RUNMQSC command:

display lsstatus(AUTOLISTENER)
1 : display lsstatus(AUTOLISTENER)
AMQ8631: Display listener status details.
LISTENER(AUTOLISTENER) STATUS(RUNNING)
PID(21534) STARTDA(2006-04-20)
STARTTI(10.26.40) DESCR(Auto start/stop listener)
TRPTYPE(TCP) CONTROL(QMGR)
IPADDR(*) PORT(1416)
BACKLOG(100)

To find the UNIX process, use the following command.
In this example, the name of the queue manager is QM_VERACRUZ.

$ ps -ef | grep runmqlsr
mqm 21534 12271 0 10:26 ? 00:00:00 /opt/mqm/bin/runmqlsr -r -m QM_VERACRUZ -t TCP -p 1416

For more information see:
http://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.ref.adm.doc/q085630_.htm
WebSphere MQ > WebSphere MQ 9.0.0 > IBM MQ > Reference > Administration reference > MQSC reference > The MQSC commands >
DEFINE LISTENER

The details for the parameter CONTROL are:

CONTROL(string)
Specifies how the listener is to be started and stopped.:

    MANUAL
    The listener is not to be started automatically or stopped automatically. It is to be controlled by use of the START LISTENER and STOP LISTENER commands. This is the default value.

    QMGR
    The listener being defined is to be started and stopped at the same time as the queue manager is started and stopped.

    STARTONLY
    The listener is to be started at the same time as the queue manager is started, but is not requested to stop when the queue manager is stopped.

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Configuration","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.0;7.5;7.1;7.0;6.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Product Synonym

wmq mq

Document Information

Modified date:
15 June 2018

UID

swg21237282