FreeKB - IBM MQ (message queue) - Getting Started
IBM MQ (message queue) - Getting Started

Home > Search

Before you can understand what MQ (message queue) is, it's helpful to see how data is transmitted without MQ. In this extremely simplified diagram, the sending system transmits data to the receiving system. In this scenario, the data would most probably be something like an email or an SMS message. While this is all fine and dandy, this type of design can produce problems. Most notably, if the receiving system is unable to receive the data (eg. the receving system is down or overwhelmed with requests), the sending system may not be able to move onto the next transmission or may continually try to send the data over and over again (which is a waste of the sending systems resources). MQ resolves these issues.


MQ sit's between the sending system and receiving system, as a sort of broker or proxy. In this way, if the receiving system is unavailable, the sending system does not get trapped in a situation where it cannot move onto it's next transmission or is bogged down trying to send the transmission over and over again. The sending system simply sends the data to MQ and then moves on (fire and forget). In this way, MQ makes it so that data tranmission is asynchronous. If this is something you want to implement, you can install the trial version of MQ server to see if this type of architecture will fit your needs.


After you've installed MQ server, your next move is to create a queue manager. As the name implies, a queue manager manages one or more queues. Enough said.


Then you'll want to create a local queue. Messages will be stored in the local queue. While not necessary, you could now also add the queue to your WebSphere dmgr.


To test things out, you can put a message in the local queue. With the current setup, messages can only be added and removed from the local queue on the MQ server itself, which isn't really pratical from a real world scenario, thus the next step is to configure MQ so that other systems and PUT and GET messages.


In order for another system to be able to PUT a message in the MQ queue, a server connection channel needs to be setup. The server connection channel is the hostname and port (socket) used to connect to the MQ server.


Next, lets configure the listener to expect a certain username and password, so that we have a basic authentication system in place for users that want to connect to our MQ server.

Congratulations! You now have an operational MQ server. Let's test these waters and create a Java application that can PUT a message on the queue. To verify that the message was PUT on the queue, you can display the messages in the queue.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 3c8e2 in the box below so that we can be sure you are a human.