RHF - A Very Useful MQ Utility

Earlier I posted two articles on java programs for browsing and writing to MQ queues. This post covers an important MQ utility and a simple summary on how to use it to read, browse, write and reply to queues. Thanks to my colleague at Perficient Inc, I discovered this hidden gem that not many Commerce developers are aware of. This utility lies in the domain of Message Broker developers, but works great even for Commerce developers. The need for this utility arises from the fact that not all development environments provide access to a reliable MQ environment during the full development cycle. They all end up testing their MQ work either on the QA or Staging servers. Utilities like these come in handy when working with MQ on a Websphere Commerce project. The best thing is that there are no limitations on the size of the messages you work with!


You can download this utility from: http://www-1.ibm.com/support/docview.wss?uid=swg24000637. While you are on this page, make sure to get the ih03.pdf file that contains some very good documentation on how to use this tool. This is an IBM SupportPac that has several other utilities embedded in it. It is a compressed zip file that consists of several executables - but for now, our interest is in just one executable called rhfutil.exe. This executable can run on its own without any dependencies - except for an MQ installation. You can simply copy this executable anywhere on your hard disk and use it right away.

Here is how I use it(These instructions are applicable to version 4.20 for MQ 6.0) :

Take a look at the following screen shot, this is the first tab titled Main(what else!):

RHF Utility Main Tab

I use this screen to basically read(note that when you read a queue, the message is removed from the queue), write(from a file) and browse messages. All you have to do is specify the Queue Manager name and hit Load Names button. All the queues within the Queue Manager will be loaded into a dropdown right below the text box where you specified queue manager name. You can even manually enter the queue name. As soon as you click on read, start browse or open a file, the second tab(Data) shows the contents of the message from read, browse or contents of the file if you opted to open a file. The good thing here is you can view the data contents in a variety of formats as shown by various radio buttons on the right. The data tab is as shown below.

RHFOutBound

Here is the cool thing. When you read a message, you can write a reply to that message, if that comes in as request message. You can find out if the message is a request message by simply taking a look at the third tab(MQMD). Take a look at the screen shot for MQMD tab. Message Type on the second row shows this information.

RHF Utility MQMD Tab

The steps to write a reply:

  1. Read the message from the queue(usually your outbound queue) on the Main tab
  2. Take a look at the message on the Data tab
  3. Check the MQMD tab to make sure it is request message
  4. Copy message id to correlation id by clicking on the "Copy MsgId to Correl Id" on the bottom right of the screen
  5. Copy the correlation id to the clip board
  6. Go back to the Main tab and open the file that contains your response
  7. Check on the Data tab to make sure that the reply message you are about to send is correct
  8. Go to the MQMD tab and set the message type to reply
  9. Paste the correlation id you copied to the clip board earlier into the correlation id field
  10. Go back to the Main tab, select the queue that should take the response(usually your inbound queue) and click on the Write Q button.

In order to make sure this works successfully, you have to ensure that you have adequate timeout period specified for your request/reply process.

Hope you enjoyed working with RHF utility. If you have any other tips on using this tool, please enter it in comments below. Thank You.

2 Comments

  1. sumanth said,

    February 5, 2009 at 5:45 pm

    RHF Util write messages to queue in bytes. Is there a way that I can make RHF Util to write a Text Message instead of a Bytes message?

  2. Sahadev said,

    February 5, 2009 at 10:46 pm

    Sumanth,
    You can write a text message. You can load a file that has text xml message in it and put that message in the queue. Your input file has the necessary text in it.
    Hope this helps.