IBM MQ Basics

Posted: March 27, 2012 in Uncategorized

Recently I started working on a project that uses IBM Websphere MQ.  Whatever I mention in this document can be found in detail if you read the Redbook for MQ Series. This article is intended to give you a quick overview and idea about WebSphere MQ and the technical terms associated with it.

Messaging

  • Program-to-program communication by sending and receiving messages to and from the queue without having a logical connection between them.

Queuing

  • Programs communicate with each other through queues.

There are 2 types of messaging

  1. Asynchronous Messaging – the sending program proceeds with its own processing without waiting for  the reply of the message.
  2. Synchronous Messaging

Note : Programmer can’t specify the name of the target application to which the message is sent. Instead, he specifies the target Queue as each queue is associated with a program.

A Message has 2 part – Data & Message Header.

  • Message Header(Message Descriptor) identifies the message(message ID) and contains information(attributes)
  • Common attributes are message type, expiry time, correlation ID, priority and name of the queue for reply.

Message Segmenting and Queuing.

  • Segmenting a  large message if it does not fit the queue and receiver can get the message in one piece or as multiple segments based on the buffer size.
  • Programmer can even segment the messages and each segment is treated as a separate physical message. Thus several physical messages building one logical message.
  • To reduce network traffic, sometimes many small messages are grouped together and sent to destination.

MQ Message Types

  1. Datagram – Message containing information, but no response is expected.
  2. Request – Message for which a reply is requested.
  3. Reply – Reply to a request message
  4. Report – A message that describes an event such as occurrence of error or confirmation or arrival or delivery.

Persistent vs Non-Persistent Messages

Deliveries of persistent messages are assured. They are written into logs to survive system failures.

Message Descriptor

  1. Version – depends on MQ version and the platform in use.
  2. Message ID / Correlation ID –  these fields are used to identity a specific request or reply.
  3. Persistent/Non-Persistent
  4. Priority
  5. Date and time
  6. Expiration Date (when is date is reached, MQGET is called and the message is discarded)
  7. Return address – (reply-to-queue or reply-to-queue manager)
  8. Format – sender can specify a value which receiver can use to decide whether data conversion is done or not.
  9. Sender application and type.
  10. Report options and Feedback Code – used for request information like confirmation of delivery
  11. Back out Counter
  12. Message Segment and Grouping

MQ Manager (MQM)

  • Manages queues and message for the application
  • Provided Message Queuing Interface (MQI) for communication between programs.

Program A  ( via MQPUT) — > Remote Queue à CHANNEL  à Local Queue à Program B (via MQGET)

Program A  (via MQPUT) — > Shared Queue à Program B (via MQGET)

Queue Manager Clusters

  • MQM’s are joined together in clusters which may run in the same machine or different machine.
  • They maintain a repository that contains the information about all the queue managers and queues in the cluster. (Full Repository)
  • The un-clustered MQM’s manage a repository that contains the information of the objects they are interested in (Partial Repository)
  • MQM uses special cluster channels to exchange information

Queue Manager Objects

  1. Queues
  2. Process Definitions
  3. Channels

Queues

Queues are classified as

  1. Local Queue                             – a real queue
  2. Remote Queue                          – structure describing a queue
  3. Transmission Queue                  – local queue with special purpose
  4. Initiation Queue                       – local queue with special purpose
  5. Dynamic Queue                         – local queue created on the fly to store intermediate results
  6. Alias Queue                              – not real queues but definitions in case you want alias names
  7. Dead-letter Queue                   – one for each queue manager to store the messages when handling situations like destination queue is full, dest queue doesn’t exist, message is too large, duplicate message sequence number etc.
  8. Reply-to Queue             – specified in request message
  9. Model Queue                            – model for local queues
  10. Repository Queue                     – holds the cluster information

Process Definitions

  • Defines an application to a queue manager.
  • Eg: the name of the program (and its path) to be triggered when a message arrives for it.

MQ Channels

Channels are classified into

Message Channels

  • connects 2 queue managers via Message Channel Agents (MCA or movers)
  • unidirectional
  • Comprises of 2 MCAs, a sender and a receiver and a communication protocol.
  • MCA is a program that transfers messages from transmission queue to communication link and vice versa

 MQI Channels

  • Message Queue Interface channel
  • Connects MQ client to a MQM in the server machine.
  • Bi-directional.

 

Advertisements
Comments
  1. Paul says:

    great post. thanks. Coincidence that you posted this literally 24 hours before I typed ‘mq basics’ into google!

  2. ShamanOfJava says:

    Watch this space for more info regarding ‘How to install & setup MQ Server 7’ and ‘Setting up a Sample MQ project’
    🙂

    • Sulaiman Khan says:

      if you want installation and configuration and also MQ project testing please contact me.

  3. Kautilya says:

    Hello Suhas…
    Quite exhaustive info u got over here: I’m pretty new over here and I hope you can help me with this:

    I’ve Windows 7 Ultimate running in my PC and have installed MQ 7.0.1
    Also I’ve installed VMware Workstation, I’ve installed Windows 2008 Server on the same.

    Now, both the host and the Virtual machine are pingable to each other: Below is the list of Objects defined and used on both

    Host Ip: 192.168.1.20
    Queue Manager: Reaper
    Xmitq: qt
    remote queue: QR (pointing to QL on QM: THUNDERBOLT)
    Sender Channel : CHL.TB, chltype: SDR, TRPTYPE: TCP, Connanme: 192.168.1.2(2000)

    VIrtual Machine Ip: 192.168.1.2
    Queue manager: Thunderbolt
    Local Queue: QL
    receiving channel: CHL.TB, chltype: rcvr
    Listener: LST IP addr: 198.162.1.2 Port : 2000

    So far so good, the sender channel when started enters the Binding state first and then goes ahead and enters retrying state. (Alas)
    And the receiving channel never changes from it’s inactive state.
    The Listener is always active and running.

    Can you help me with this?

  4. Chinna says:

    It’s almost a year and you’ve still to come up with a write up on v7

  5. Aditya says:

    Dear All,

    I am a new person to MQ. I have a small query wrt to queue.
    Is it possible to push messages from a Local queue (as soon as it is posted on the queue) to Remote queue (Different server on same network) without using any external programming (like using java utility to read from local queue and post the same on the remote queue). Is there any internal arrangement possible within MQ ?

    Thanks,
    Aditya

  6. Banesh balu says:

    hello ,
    I am a new learer of web sphere MQ i dont have any idea about this tool,so please guide me.. ..

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s