Date Created: Wed 02-Feb-2011

Related Document Categories:

Get my WebSphere MQ course here >> http://www.themiddlewareshop.com/products/


Creating a remote Queue on a remote queue manager on Linux and connecting using an MQ client written in Java

I created a QM called QM_TEST as a default Queue Manager

crtmqm -q QM_TEST

Start the Queue Manager

strmqm


WebSphere MQ queue manager 'QM_TEST' starting.
5 log records accessed on queue manager 'QM_TEST' during the log replay phase.
Log replay for queue manager 'QM_TEST' complete.
Transaction manager state recovered for queue manager 'QM_TEST'.
WebSphere MQ queue manager 'QM_TEST' started.


Create a listener for port 1450

nohup runmqlsr -m QM_TEST -t TCP -p 1450 &

ps -ef | grep -i runmqlsr

You can use endmqlsr for example endmqm -i QM_TEST to force the QM to stop immediately

============== OR ===========

You can also create an MQ Listener using the MQSC environment


DEFINE LISTENER (TEST1450) +
TRPTYPE (TCP) +
PORT (1450) +
CONTROL(QMGR)


Note

If we use an MQ command "runmqlsr" to start a listener, then we cannot give it a name, and we need to start it manually every time the Queue Manager is started or restarted.

By using the MQSC environment, we can set options for the Listener to start when the Queue Manager starts, the control option above CONTROL(QMGR) allows the listener to be restarted when the QM is restarted.

================

Because we have set a default Queue Manager we can just use runmqsc to run the MQSC to confgure or display the listener

runmqsc

display listener(TEST1450)

AMQ8630: Display listener information details.
LISTENER(TEST1450) CONTROL(QMGR)
TRPTYPE(TCP) PORT(1450)
IPADDR( ) BACKLOG(0)
DESCR( ) ALTDATE(2011-02-02)
ALTTIME(01.03.44)

end

================

Shortcut command line

same as: echo 'display listener(TEST1450)' | runmqsc

================


This will create a listener TEST1450 using TCP and port 1450 and when the QMgr is started or stopped the listener will do the same. If the listener ends for any reason you can restart manually with this runmqsc command:

start lstr(TEST1450)

To check the status of listener:

dis lsstatus(TEST1450)


=================

Before you try and connect, it is a good idea to set DEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) for test environment using runmqsc, which allows remote administration of a Queue Manager using MQ Explorer. Remember that MQ authentication is all about users/groups, so you may have to alter the userid to tell MQ explorer to connect as a specific MQ user which is a valid user in the'mqm' group on the MQ server in my case the server is Linux.






Setting the user name to mqm so I can connect to the Queue Manager.





Once a client channel has been created as seen in the setupMQ.mqsc script below, you can connect to the client channel using MQ Explorer





Here is the Java code.

Note: Once you have created the server to client channel then the Java client will be able to connect to MQ server

go.shgo.shMQRead.javaMQRead.javasetEnv.shsetEnv.shsetupMQ.mqscsetupMQ.mqsc

I have not written everything down (Will let you do some of the reading between the lines and leg work) , but it should give an introduction of how to create and test a simple MQ java client.

Get my WebSphere MQ course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories