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 » Browsing the Queue

Post new topic  Reply to topic
 Browsing the Queue « View previous topic :: View next topic » 
Author Message
Jeffrey P
PostPosted: Wed Oct 01, 2003 6:06 am    Post subject: Browsing the Queue Reply with quote

Novice

Joined: 27 Aug 2003
Posts: 20

Im wanting to do some processing on messages from a particular queue. All I need to do is get all of the messages on the queue and process them accordingly. My question is, do I have to set up the browsing options or can I just loop through the messages based on MyQueue.getCurrentDepth() and do a "get" on each iteration? Thanks.

Jeff
_________________
Jeff
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Oct 01, 2003 6:19 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

You would need to browse only when you think you dont need to remove the message off the queue completely. If you have to remove the messages completely/destructively, then you should not use browse options in GMO. Looking at your description, it seems that you wish to do some processing/manipulations on the message itself. In that case you should not use browse options.


Cheers
Kumar
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeffrey P
PostPosted: Wed Oct 01, 2003 6:26 am    Post subject: Browsing the queue Reply with quote

Novice

Joined: 27 Aug 2003
Posts: 20

Thanks, I really appreciate it. Upon further review however, Ive discovered that I will in fact need to browse. Think Jeff, think!!! I take it that if I do set the browse options that when I do a "get", the message will not be taken off of the queue. How do I get the message officially off of the queue if after browsing I determine that it is a message that I need to process? Im assuming that I will need to reset the browse options accordingly based on each message but not sure. Also, do I have to keep setting the options to MQC.MQGMO_BROWSE_NEXT to get to the next message or just loop based on the queue depth? Thanks a bunch!
_________________
Jeff
Back to top
View user's profile Send private message
vennela
PostPosted: Wed Oct 01, 2003 6:55 am    Post subject: Re: Browsing the queue Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Jeffrey P wrote:
just loop based on the queue depth? Thanks a bunch!


I am not sure if this is possible because we can't get the number of messages in the queue
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeffrey P
PostPosted: Wed Oct 01, 2003 7:10 am    Post subject: browsing queue Reply with quote

Novice

Joined: 27 Aug 2003
Posts: 20

Wouldnt the getCurrentDepth method on the MQQueue object work for getting the number of messages on the queue?
_________________
Jeff
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Oct 01, 2003 7:20 am    Post subject: Re: browsing queue Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Jeffrey P wrote:
Wouldnt the getCurrentDepth method on the MQQueue object work for getting the number of messages on the queue?


Only if you've opened the queue with the Inquiry open option.

But if you loop over MQC.MQGMO_BROWSE_NEXT, you'll get a 2033 (no more messages on the queue) when you reach the end. So you don't need to bother to count. Plus, this way, you don't have to worry about the queue depth *changing* while you're reading the queue - which you do if you haven't opened the queue for exclusive input.
_________________
I am *not* the model of the modern major general.


Last edited by jefflowrey on Wed Oct 01, 2003 9:11 am; edited 1 time in total
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Oct 01, 2003 7:36 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

The way you could do this is something like this.

while (rc != 2033)
{
Browse msgs... with browse next.
If msg == the message you were looking for....
then do a destructive get...
else
carry on...

}


Unless the if condition is satisfied the message always stays back on the queue.

Cheers
Kumar
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeffrey P
PostPosted: Wed Oct 01, 2003 8:01 am    Post subject: Reply with quote

Novice

Joined: 27 Aug 2003
Posts: 20

If running in browse mode, how do we specify a "destructive" get? Do we just change the get options for each message based on whether to process it or not? Thanks.
_________________
Jeff
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Oct 01, 2003 8:13 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

You got it...!!!

while (rc != 2033)
{
Browse msgs... with browse next.
gmo = browse.
If msg == the message you were looking for....
gmo = anything - browse.
then do a destructive get...
else
carry on...

}

Cheers
Kumar
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeffrey P
PostPosted: Wed Oct 01, 2003 8:22 am    Post subject: Reply with quote

Novice

Joined: 27 Aug 2003
Posts: 20

Thanks for all the help.
_________________
Jeff
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 » Browsing the Queue
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.