Basics IBM Websphere MQ Series

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.

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.pro.doc/q004390_.htm

Display queue managers before

dspmq

If the queue manager does not already exist create a queue manager

crtmqm QM1

Start the queue manager

strmqm QM1

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.pro.doc/q004390_.htm

This command will modify the queue manager. For example here channel authentication are not recorded :

ALTER QMGR CHLAUTH(DISABLED) | runmqsc QM1

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.adm.doc/q085320_.htm

Create a channel

Definition of a channel

WebSphere MQ uses two different types of channels:

  • A message channel, which is a unidirectional communications link between two queue managers.
  • An MQI channel, which is bidirectional and connects an application (MQI client) to a queue manager on a server machine.
  • https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.1.0/com.ibm.mq.explorer.doc/e_channels.htm

    How to create a Channel ?

    https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.adm.doc/q085520_.htm

    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');
    

    https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.1.0/com.ibm.mq.doc/ic12510_.htm

    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 ?

    https://stackoverflow.com/questions/31745360/what-is-the-difference-between-a-message-channel-and-the-message-queue-itself

    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,
    etc.

    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.

    show_queue_manager - Copy

    TROUBLESHOOTING MQexplorer

    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:

    strmqm QM1
    

    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.

    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s