MQ

 View Only
  • 1.  Defining and starting MQ listeners

    IBM Champion
    Posted Wed December 01, 2021 03:23 PM
    I'm seeing some confusing behavior when I define and start a listener for port 9414.  I define the listener as follows in my runmqsc file:

    DEFINE LISTENER('MY.LISTENER.TCP') TRPTYPE(TCP) PORT(9414) CONTROL(QMGR) REPLACE

    My understanding from the docs is that CONTROL(QMGR) means the listener is automatically started and stopped along with the qmgr.  However, when the server starts I find that the listener is not running even though the qmgr is started.  No problem, I'll just add the START command to the command file, like this:

    DEFINE LISTENER('MY.LISTENER.TCP') TRPTYPE(TCP) PORT(9414) CONTROL(QMGR) REPLACE
    START LISTENER('MY.LISTENER.TCP') 

    Now, I get a warning following the START command:

    AMQ8730W: Listener already active.

    What am I missing?  I need the listener to be started once the runmqsc command completes (preferably w/o the warning).

    Thanks,
    Jim



    ------------------------------
    Jim Creasman
    ------------------------------


  • 2.  RE: Defining and starting MQ listeners

    IBM Champion
    Posted Thu December 02, 2021 12:22 AM

    Please try issuing the following MQSC command.

    DISPLAY LSSTATUS(*) PORT

    to see what other listeners might be already using that port number. If you find that there is a different object name there, then perhaps you already have a defined listener, automatically starting, using that same port number. If you find that there is an object called 'SYSTEM.LISTENER.TCP.1' then you have a runmqlsr control command using that port. This might be automated outside of the queue manager control.

    Also, it would be worth taking a look at the queue manager AMQERR01.LOG as all the automatically started listeners will report themselves starting up in there.

    AMQ5026I: The listener 'MY.LISTENER.TCP' has started. ProcessId(51108).

    EXPLANATION:
    The listener process has started.
    ACTION:
    None.

    This should show you that your CONTROL(QMGR) listener did attempt to start up, but couldn't bind to the port because it was in use by someone else.

    Finally, if your script is running regularly (you don't really say when/where this script is running), i.e. you are doing a DEFINE REPLACE of the LISTENER which is already there and running, and you need it to work regardless of whether it is the first time of running (where the START is needed) or a subsequent time of running (where the START is not needed), then you should add the IGNSTATE(YES) keyword to the START LISTENER command.

    Cheers,
    Morag



    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    Website: https://www.mqgem.com
    ------------------------------



  • 3.  RE: Defining and starting MQ listeners

    IBM Champion
    Posted Thu December 02, 2021 11:18 AM
    Thanks Morag and Prema,

         Took a bit of investigation but I figured out why the listener was already started.  Turns out the DEFINE/START commands had already been executed.  As for the background, this is all inside a container that starts fresh each time.  There are no residual artifacts left from a prior run.  The MQSC command file is generated and run after the qmgr is created. 

         What I failed to realize is that by adding the -ic option to crtmqm a command file was being automatically run (with these two commands) at the time the qmgr is created.  The deployment script generates a subsequent MQSC file after crtmqm and runs this with runmqsc.  This file happens to also contain those same commands, meaning they were indeed being run twice.  Simple programmer error (as most are).

         Thanks again for your help.  It was a useful debugging exercise.  I plan to add the IGNSTATE(YES) option just to future proof the code.

    Jim

    ------------------------------
    Jim Creasman
    ------------------------------



  • 4.  RE: Defining and starting MQ listeners

    Posted Thu December 02, 2021 12:50 AM
    Hi Jim,

    Please check if the listener process is running by running the command : ps -ef | grep -i runmqlsr , 

    bash-4.2$ ps -ef | grep -i runmqlsr
    mqm 29184 29025 0 21:38 ? 00:00:00 /opt/mqm/bin/runmqlsr -r -m QM1 -t TCP -p 9414
    mqm 29206 28907 0 21:38 pts/0 00:00:00 grep -i runmqlsr

    You will find the process if listener is running.

    AMQ8730W: Listener already active - you will get only when listener is already running on the same port.

    See the runmqsc output:

    DEFINE LISTENER('MY.LISTENER.TCP') TRPTYPE(TCP) PORT(9414) CONTROL(QMGR) REPLACE
    2 : DEFINE LISTENER('MY.LISTENER.TCP') TRPTYPE(TCP) PORT(9414) CONTROL(QMGR) REPLACE
    AMQ8626I: IBM MQ listener created.
    START LISTENER('MY.LISTENER.TCP')
    3 : START LISTENER('MY.LISTENER.TCP')
    AMQ8021I: Request to start IBM MQ listener accepted.
    end

    If I issue the same commands again in runmqsc , you might get
    START LISTENER('MY.LISTENER.TCP')
    AMQ8730W: Listener already active.


    Thanks & Regards,
    Prema U. L.
    Release Effectiveness MQ Team, India Software Lab,
    IBM India Pvt. Ltd., 6th Floor, Block C,
    EGL, Bangalore - 560071





    ------------------------------
    Prema Laxmanachar
    ------------------------------