WebSphere MQ Series Listen Message Handler works just once

We are trying to integrate a system where a custom built application speaks with WebMethods through WebSphere MQ Series. We need to make this realtime as much as possible. We tried to use a Listen Message handler with shutdown interval of 1 minute (though we would like to have it even smaller). We found that after enabling the message handler, it fetches a message from the MQ Server only once.

We are using WebSphere MQ Series Trial version 5.3 and adapter version 3.0

Can anybody help?

The “listen” timeout just controls how long the adapter waits for a message from the “get” operation that it issues before reissuing a new get.

Is your listener becoming disabled? Did the first message handler complete successfully?

My current client is using MQ Adapter’s “listen” service extensively with no problems. What hardware and operating system are you using?


Thnx for the reply.Actually we are using P3 512Mb Windows 2000 server.Websphere MQ Adapter3.0 and Webmethods 6.0.1.
We are using a trial version of Websphere MQ 5.3.Should that matter?
THe listener doesnot get enabled or disabled automatically.
I get the following error:
java.lang.IllegalArgumentException: timeout value is negative
at java.lang.Object.wait(Native Method)
at com.wm.pkg.imdk.pool.ConnectionPool$ConnectionTimeoutMgr.run(ConnectionPool.java:780)
I have also installed service pack3.0
Also sometimes the listener works even if it is disabled and doesnot work if it is enabled i.e the message is not got it remains on the queue and the messages keep adding up.

According to the MQ Adapter user guide “If the message service itself fails (causes an exception), the Listen message handler logs the error in the Queue Manager’s error log and then shuts itself down.” Is there a possibility that your message handling service is throwing an exception?

Also, the “timeout value is negative” looks suspicious. What happens if you set the timeout higher? Do you still get the same message?

Again, I believe this shutdown interval simply controls how often the adapter re-issues a get (and the wait time of the get). Your application would only be in a “non-listening” state during the time it takes for one get to timeout and the next one to be issued by the server (surely only a matter of a second or two in the worst case).


Hi Mark,
I feel u r right about the listener getting disabled.Also abt the shut down interval and get coz it used to show “MQJE001: Completion Code 2, Reason 2033” -NO MSG AVAILABLE every 1 min.(shut down interval) but now only after i enable it from the Admin utility.is there any way I can fix it? I tried unistallin n installin the adapter 3-4 times.
Also could u please tell me where do u set the timeout value…I am referring WebsphereMQ Adapter user guide 3.0 but was unsuccessful in finding the same there.


You specify the shutdown interval when you create or edit the Message Handler Service using the webMethods Admin tool. For listen operations you must first create services using Developer that will process your messages in normal and exception cases.

Here’s a screen shot that shows this:

The service that you create to process your messages should have the following inputs:

  1. message (document) []msgbody (string) []connectionID (string)

To test this I created a one-line flow service that invokes pub.flow:debugLog setting the “message” parameter to
“Message text = %msgbody%”. (be sure to check the “Enable variable substitution” checkbox).



Hi Mark, Merry Christmas.Sorry for replying this late.
Actually,I know this is wierd but the listener works only on one setup…against the three setups I have running so some how the listener is working now on a setup but the Get message handler doesnot filter the message by the correlation Ids.I explicitly set a correlation Id ,put it on a queue and then try to reteieve the same message with that corellation Id,but it returns the message as the first in first out pattern. I also tried using string to bytes and setting Correlationbytesarray and also MsgIdByteArray to Correlationbytesarray…that too doesn’t work.I have applied service pack 2 for websphereMQ… what else do I need to do? n ya that debug service was of grt idea…it didnt strike me…


Merry Christmas to you as well. We had a touch of snow here in Colorado today, but not quite the white Christmas of the movies. No matter, here in Evergreen in the foothills of the Rockies, we still have some snow around from the last good snowfall a week or so ago.

I haven’t tried using correlation ID’s, so I’m afraid I can’t help you there. How are correlation ID’s normally used with MQ queues? Is it to retrieve a single message or is it to retrieve a group of messages with the same correlation ID? Does the MQ queue have to be setup in a special way to make use of correlation ID’s?



Try this.

In your “put” handler set the msgHeader/MsgId with your customUserID. now in the “get” handler use this customUserID as your msgHeader/CorrelId.


Hi Thahir,
i am doing it exactly as this.I created a put and get message handler.
In a flow service I call the put handler.when the message is put on the queue I can see a corelation id set for that message.
Then when I call the get message handler I map the MsgId of the message I just put to the CorrelId field for the “service in” of the get msg handler,still I am not able to retrieve the same message.
I also tried explicitly setting the correlation Id (say abc)while putting the message n then giving the same while getting it but it doesn’t work… is all this happening coz of the trial version??? I am using Websphere MQ 5.3 trial version.

Hi Mark,
Hey it must b a grt place to live… snowfall,foothills of Rockies…just like in movies…

No Mq doesnt need to be setup in a special way 4 using correlation id.correlation id is basically some unique id u set while u put the message n u can retrieve the message based on the same…
Generally used for single message, for group message u can set “match options” and check if the message belongs to a particular group , though am not sure how u do all these in webmethods…

We ran into the same issue of correlationID. We are on SP3 with websphere3.0. Upon investigation we found that correlationID is overwritten by the message handler. So it would not take the id we set it through the services.

We got fixes for the same and it seems to be working.



What is the number or ID of the fix that webMethods provided to address this issue?


ya cud u plz let us know dat???


I know its kind of foolish to ask, but are you commiting the message.


No Thahir its not foolish sometimes such silly mistakes take a lot of time.
ya am commiting the message…
I found fixes 7-10 on webmethods site but none mentions abt the correlation ID thing…


Hi Sanjay

I was on a project when you initially replied, so I responded lately. correlationID is working for me, and I had not used those fixes. Did you fix the issue.

It was not very clear to me when you explained the steps you had taken. Could you explain in detail like what mapping you did on put and get handlers. I am more interested in the inputs of both services.


Hi Tharir,

Sorry I got late this time.
ur first post of assigning customUserID is working.Actually initially I was trying to use the MsgHeader/MsgID generated by a put handler and map this MsgHeader/MsgID to MsgHeader/CorrelID while another put so I wouldnt have to generate a different uniqueID but now am using it as u have said…I was using the MsgID itself as customUserID …so it was not wrking
It wrked at last !!!

Hi all,
Thanks so much …dont think wud have bn able to solve this without ur help…

Hello all:
I am having a problem witht he CorrelId, i am using 4.6 and MQ on websphere. In my get service i am mapping the messageHeader/msgId,Correlid etc. And when my response service is called i map these. From the above post it was unclear to me, if i need to map the msgId from the GET service to the correlId of the PUT, as right now i am doing - Correlid(get)–>Correlid(put) – this shows up as null and the response message has null values in these fields. what am i doing wrong, appreciat all the info, thanks!