ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » QueueReceiver.receive(timeout) not work as expected.

Post new topic  Reply to topic
 QueueReceiver.receive(timeout) not work as expected. « View previous topic :: View next topic » 
Author Message
x3302
PostPosted: Tue Feb 18, 2014 7:34 pm    Post subject: QueueReceiver.receive(timeout) not work as expected. Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 18, 2014 10:06 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
x3302
PostPosted: Wed Feb 19, 2014 12:13 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Wed Feb 19, 2014 12:21 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

http://www-01.ibm.com/support/docview.wss?uid=swg21248089&myns=swgws&mynp=OCSS7K4U&mynp=OCSSFKSJ&mynp=OCSSEQTP&mync=E
_________________
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
View user's profile Send private message
x3302
PostPosted: Thu Mar 13, 2014 11:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Fri Mar 14, 2014 1:41 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
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
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 14, 2014 5:57 am    Post subject: Reply with quote

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
View user's profile Send private message
x3302
PostPosted: Tue Mar 18, 2014 12:39 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 18, 2014 12:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
x3302
PostPosted: Thu Mar 20, 2014 10:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » QueueReceiver.receive(timeout) not work as expected.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.