Author |
Message
|
wgoldman |
Posted: Thu Sep 30, 2004 11:52 am Post subject: mqmessages are not removed from queue and queue is filling u |
|
|
Newbie
Joined: 30 Sep 2004 Posts: 4
|
I use the following code (running on a resin server, using com.ibm.mq api's) to retrieve a message from the queue;
MQQueue replyQueue = manager.accessQueue("MY.REPLY.QUEUE",MQC.MQOO_INPUT_AS_Q_DEF,"MYMQMANAGERNAME",null,null);
MQMessage replyMsg = new MQMessage();
replyMsg.correlationId = aCorrelationId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.matchOptions = ( MQC.MQMO_MATCH_MSG_ID | MQC.MQMO_MATCH_CORREL_ID );
gmo.options = MQC.MQGMO_WAIT;
gmo.waitInterval = 60000;
replyQueue.get(replyMsg, gmo, 4096);
String reply = replyMsg.readString(4096);
How can I programmatically remove this message from the queue? |
|
Back to top |
|
 |
vennela |
Posted: Thu Sep 30, 2004 11:54 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Is there any reason you are using this
Code: |
gmo.matchOptions = ( MQC.MQMO_MATCH_MSG_ID | MQC.MQMO_MATCH_CORREL_ID );
|
If not comment this out and your messages will be gone |
|
Back to top |
|
 |
wgoldman |
Posted: Thu Sep 30, 2004 11:57 am Post subject: |
|
|
Newbie
Joined: 30 Sep 2004 Posts: 4
|
Yes it is to locate a specific message on the queue using the correlation id. This code was inherited and I have slightly better than entry level mq experience. So if there are other settings that allow the selection of a specific message and removal (once it has been read), I am all ears. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 30, 2004 12:00 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If the message is READ ,that is if you get a successful return code from your get, then the message is REMOVED from the queue.
Unless the options have been set to browse the queue, which your code has not done. Or if your code is running in a transaction, then the message will not be REMOVED from the queue until the transaction is committed. But again, your code isn't doing this.
So if your code is not getting the message, then it is because the Message ID or Correlation ID are not matching. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wgoldman |
Posted: Thu Sep 30, 2004 12:03 pm Post subject: |
|
|
Newbie
Joined: 30 Sep 2004 Posts: 4
|
My code is getting and reading the message, it is just not being removed from the queue. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 30, 2004 12:09 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
wgoldman wrote: |
My code is getting and reading the message, it is just not being removed from the queue. |
How do you know? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wgoldman |
Posted: Thu Sep 30, 2004 12:42 pm Post subject: |
|
|
Newbie
Joined: 30 Sep 2004 Posts: 4
|
Actually this correspondence got the wheels turning and I realized that the reason the messages were not being removed was because the production system was receiving 'time outs' attempting to read the message, so in fact the application was NOT reading the message successfully.
The reason the app was receiving a time out is another discussion, but the jist of it is the secondary application responsible for posting the message is too slow in doing so.
Thank you for your help! |
|
Back to top |
|
 |
|