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 » Looping with get using wait interval?

Post new topic  Reply to topic
 Looping with get using wait interval? « View previous topic :: View next topic » 
Author Message
rtgordon
PostPosted: Thu Nov 01, 2001 7:27 am    Post subject: Reply with quote

Apprentice

Joined: 27 Jun 2001
Posts: 34
Location: Lewisville, TX

Is it better to specify a wait interval and a simple get (MQJava) or put a loop on the get? (while there aren't any message try to get a message) Or does it make any difference?

I have seen both, and I guess what I am asking is if there is any reason that you would want to do the second. Is there any delay at all between the time that the message arrives and the time the message is processed if a wait interval is speicified?

gordon
Back to top
View user's profile Send private message Send e-mail
bduncan
PostPosted: Thu Nov 01, 2001 11:25 am    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Imagine the following scenario. My application has an empty queue open. A message will arrive on this queue in 4 seconds. In the first case, my application issues an MQGET with a 5 second wait time. In the second scenario, it does an MQGET with no wait, and loops. Of course, the first case would still be wrapped in a loop, but it would only issue the MQGET every 5 seconds. The rate at which the second case loops depends on platform, language, and other factors (are you matching against CorrelId, etc...) but typically an MQGET on an empty queue will take very little time. So you could expect your application to loop several hundred times per second, perhaps more. The second approach obviously uses more resources than the first, and the queue manager is more taxed. Because of this, most people prefer to code their applications with wait intervals. As far as scenarios when the second approach is better, I can imagine an application where doing an MQGET and not getting a message (empty queue) is an important event, and processing needs to be done if this situation arises. Of course, if you do an MQGET with a long wait time, your application is blocked until the call returns so you can't do any of this processing. If my application was controlling some real-time system, and commands came in via MQSeries, it might be important for me to know immediately whethere there is a message waiting for me, and if not, execute some logic...


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Looping with get using wait interval?
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.