This article introduced a simple MQ Server composed of a queue manager, local queues, channels. Channels allow the queues to communicate between each other. Aliases can also be used to give an alias to queues.
Create a queue manager
Queue managers are the main components in a WebSphere MQ messaging network.
Display queue managers before
If the queue manager does not already exist create a queue manager
Start the queue manager
This command will modify the queue manager. For example here channel authentication are not recorded :
ALTER QMGR CHLAUTH(DISABLED) | runmqsc QM1
Create a channel
Definition of a channel
WebSphere MQ uses two different types of channels:
How to create a Channel ?
In our app we use a “receiver channel”
A receiver channel is a message channel that the queue manager uses to receive messages from other queue managers.
Verify existence of channel
dspmqfls -m QM1 -t CHAN_RCV
Create a receiver channel
runmqsc QM1 <<e@ DEFINE CHANNEL(CHAN_RCV) CHLTYPE(RCVR) TRPTYPE(TCP);
Also we use “Sender channel”
A sender channel is a message channel that the queue manager uses to send messages to other queue managers.
Create a receiver channel
runmqsc QM1 <<e@ DEFINE CHANNEL(CHAN_SEN) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME(CON_X) XMITQ(XMIT_X) REPLACE DISCINT(SCINT_);
What is a purpose of a transmission queue ?
We need this queue to send a message to another queue.
Create a transmission queue :
runmqsc QM1 <<e@ DEFINE QLOCAL(SDF.45.78.0DF) USAGE(XMITQ) TRIGGER INITQ(SYSTEM.CHANNEL.INITQ) DEFPSIST(YES) MAXDEPTH(5000) REPLACE DESCR('Reception queue');
Create a local queue/in for the reception of message
runmqsc QM1 <<e@ DEFINE QLOCAL(SDF.45.78.0DF) USAGE(NORMAL) PUT(ENABLED) GET(ENABLED) DEFPRTY(0) REPLACE MSGDLVSQ(FIFO) DEFSOPT(SHARED) NOTRIGGER ;
Create a corresponding alias of the queue. It is a link to the queue.
DEFINE QALIAS(QRECEPT) REPLACE TARGQ(SDF.45.78.0DF) DEFPSIST(YES);
Create a local queue/out to send messages
It is the same thing as for the reception of the message. Only the name of the queue is different.
What is the difference between queue and channel in MQ ?
For IBM MQ one endpoint is always the queue manager (a type of messaging engine) and the other is an application or another queue manager.
Based on this example, it should be obvious that channel as used in the book and channel as defined by any messaging transport are at different levels of abstraction. As used by MQ, a channel is a specific set of configuration parameters that define a communication path and includes such attributes as CONNAME, MAXMSGL, tuning parameters, SSL parameters,
Once an MQ channel is successfully started, you can see a running instance of it by displaying the channel status. In the case of CLUSRCVR, SVRCONN, and (less commonly) RCVR or RQSTR channels, you may see multiple instances of the same channel active simultaneously.
How to connect to a queue manager in MQ ?
I actually use the mqexplorer(mqj.cmd) from Windows. The project is opensource at https://www.openhub.net/p/mqjexplorer .
Run the program MQ explorer and from “Show Queue Manager” choose a remote queue for distant server MQ.
If there is an error in mqjexplorer(example with MQRC_Q_MGR_NOT_AVAILABLE)
http://www-01.ibm.com/support/docview.wss?uid=swg21227679 , verify that queue is started:
If it is OK then verify that the listener is started :
runmqlsr -m QM1 -t TCP -p PORT_MQ &
Normally it fixes the issue of queue manager not being accessible from mqexplorer.