WebSphere MQ

WebSphere MQ Configuration

Create a Queue Manager

crtmqm -lc -ld /var/mqm/logs -md /var/mqm -q qmgr1

-lc : Circular Logging

-ld : Log Directory

-md : MQ Data to hold the queues/channels and other data

-q : Queue Manager Name

Start the Queue Manager

strmqm qmgr1

Check the Queue Manager Status

dspmq

Create a Server Connection Channel and a Local Queue

runmqsc qmgr1

DEF CHL(MYSVRCONN) CHLTYPE(SVRCONN)

DEF QL(MYQLOCAL) DEFPSIST(YES)

View the Channel and Local Queue just created

runmqsc qmgr1

DIS CHL(MYSVRCONN)

DIS QL(MYQLOCAL)

Send sample message to the new Queue

There are two sample programs that comes with WebSphere MQ:

/opt/mqm/samp/bin/amqsput <queue> <queue_manager>

This can be used for a local connection to the queue manager.

/opt/mqm/samp/bin/amqsputc <queue> <queue_manager>

This can be used to connect to the queue manager from a remote server. However, you need to specify the Channel name and the connection information using a special environment variable as below:

MQSERVER=ChannelName/TransportType/ConnectionName

Example : export MQSERVER=’MYSVRCONN/TCP/localhost(1414)’

Issues while connecting to the queue

While sending message using amqsput, you might not get an issue, since the connection is local. However, amqsputc can render various issues depending on the configuration. Since amqsputc can be used to connect remotely to the queue manager, few things come into picture:

There are 3 ways to specify the connection configurations at the client end. Below are the ways, in order of precedence:

Note : In case, there is any issue in the connection, you will can look at the errors under : /opt/mqm/errors/AMQERR01.LOG. This log contains the Client related errors. In case, you don’t find anything in the above logs, check in the mqserver logs : /var/mqm/<qmgr>/errors/AMQERR01.LOG

1. MQSERVER definition

Make sure that the queue manager listener is RUNNING and listening to the correct address, specified in the variable.
Example : export MQSERVER=’MYSVRCONN/TCP/localhost(1414)’
At the server side, the default listener has to be started manually every time, after starting the queue manager.
Instead, update the configuration to start the listener automatically along with the queue manager:
ALTER LISTENER(SYSTEM.DEFAULT.LISTENER.TCP) TRPTYPE(TCP) CONTROL(QMGR)
You can start the listener, using below command:
START LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)

2. mqclient.ini file (introduced in MQ 7.0)

You can use MQCLNTCF env variable to mention which mqclient.ini file to use. By default, it will be the one under /var/mqm/mqclient.ini
More details can be found here.

3. CCDT file


If there are multiple channel definitions in CCDT file, the client tries to use the channels by alphabetical order of the channel names
More details can be found here.

If you are getting below error while connection, that means, you are being blocked by Channel Security:

AMQ9776E: Channel was blocked by userid

We can easily establish the connection by disabling Channel Authentication and Connection Authentication at the queue manager, but that is not recommended. However, for now, you can do that using below command and try the connection:

ALTER QMGR CHLAUTH(DISABLED)

ALTER QMGR CONNAUTH(”)

REFRESH SECURITY

Click the respective links to find more details on Channel Authentication and Connection Authentication.

Leave a Reply

Your email address will not be published. Required fields are marked *