Author |
Message
|
x3302 |
Posted: Tue Feb 18, 2014 7:34 pm Post subject: QueueReceiver.receive(timeout) not work as expected. |
|
|
Newbie
Joined: 18 Feb 2014 Posts: 5
|
I expect qReceiver.receive(timeout) is the application to keep check the local queue if any proper message until timeout.
I use below code segment to listen to the local queue.
QueueReceiver qReceiver = qSession.createReceiver(qLocal, "JMSCorrelationID = '"+ strMsgID +"'");
Message msg = qReceiver.receive(10000);
If the local queue have the message before calling qReceiver.receive(10000), I can successful get the message.
If the local queue haven't any message before calling qReceiver.receive(10000), and I put the msg to the local queue after calling it. (ie. 2 seconds later).
Strange thing happen, I can see the msg I put have been fetched by application (due to 0 queue depth). But the qReceiver.receive(10000) still hanging until timeout and return null.
After that, I browse the local queue and found the msg I put exists again, with the timestamp when qReceiver.receive(10000) return null.
Can some explain if is the expected behaviour?
Now I need to use Thread.sleep(10000) before call qReceiver.receive(1) as walkaround. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 18, 2014 10:06 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
No you don't! Think about it and prove that there is no commit timing issue.
Also I did not see the version (maybe I am going blind). Could be that you just need to upgrade to the latest fixpack!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
x3302 |
Posted: Wed Feb 19, 2014 12:13 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2014 Posts: 5
|
fjb_saper wrote: |
No you don't! Think about it and prove that there is no commit timing issue.
Also I did not see the version (maybe I am going blind). Could be that you just need to upgrade to the latest fixpack!  |
How to check the MQ version in runtime?
MQ server is 7.0.1.6
MQ jar reference for development is also 7.0.1.6.
But I am not sure what MQ version is used by the WAS. |
|
Back to top |
|
 |
zpat |
Posted: Wed Feb 19, 2014 12:21 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
|
Back to top |
|
 |
x3302 |
Posted: Thu Mar 13, 2014 11:50 pm Post subject: |
|
|
Newbie
Joined: 18 Feb 2014 Posts: 5
|
I used WAS 8.5
And use the MQ jars 7.1.0.0 which inside WAS 8.5 for library.
But the "qReceiver.receive(10000)" still not works as expected....
Any suggestion? |
|
Back to top |
|
 |
zpat |
Posted: Fri Mar 14, 2014 1:41 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I wouldn't recommend using any version/release ending in 0.0 ! _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Mar 14, 2014 5:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
zpat wrote: |
I wouldn't recommend using any version/release ending in 0.0 ! |
All releases end in 0.0.0.0.0.0.0.0, for as many zeros as you'd like to add. |
|
Back to top |
|
 |
x3302 |
Posted: Tue Mar 18, 2014 12:39 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2014 Posts: 5
|
The problem is not about MQ versions, but coding.
I have a QueueSession created a consumer to Local Queue "A".
And I tried to reuse this QueueSession to create QueueReciever to receive message from Local Queue "B".
However, receiveNoWait() is working while receive(timeout) is not.
After I create another QueueSession to create QueueReciever for Local Queue "B", everything is normal now.
Is it make sense? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Mar 18, 2014 12:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
x3302 wrote: |
The problem is not about MQ versions, but coding.
I have a QueueSession created a consumer to Local Queue "A".
And I tried to reuse this QueueSession to create QueueReciever to receive message from Local Queue "B".
However, receiveNoWait() is working while receive(timeout) is not.
After I create another QueueSession to create QueueReciever for Local Queue "B", everything is normal now.
Is it make sense? |
Doesn't the manual say somewhere that any other MQ operation used in a receiving MDB needs to happen in a different session? I'd say working as designed...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
x3302 |
Posted: Thu Mar 20, 2014 10:10 pm Post subject: |
|
|
Newbie
Joined: 18 Feb 2014 Posts: 5
|
fjb_saper wrote: |
x3302 wrote: |
The problem is not about MQ versions, but coding.
I have a QueueSession created a consumer to Local Queue "A".
And I tried to reuse this QueueSession to create QueueReciever to receive message from Local Queue "B".
However, receiveNoWait() is working while receive(timeout) is not.
After I create another QueueSession to create QueueReciever for Local Queue "B", everything is normal now.
Is it make sense? |
Doesn't the manual say somewhere that any other MQ operation used in a receiving MDB needs to happen in a different session? I'd say working as designed...  |
Understand, but most strange thing is the receiveNoWait() is working while using the existing session.... |
|
Back to top |
|
 |
|