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 » How can I get the last 100 messages from a queue?

Post new topic  Reply to topic
 How can I get the last 100 messages from a queue? « View previous topic :: View next topic » 
Author Message
dstrower
PostPosted: Fri May 06, 2005 8:31 am    Post subject: How can I get the last 100 messages from a queue? Reply with quote

Newbie

Joined: 02 May 2005
Posts: 3

I need to look at the last 100 messages in a large queue.
I am currently opening the queue and using a loop to run the get() command multiple times until I get to the 100 messages.
Is there an easier way to do this?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri May 06, 2005 8:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Why is that a "hard" way to do this?

No, there is no other way to do this.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vennela
PostPosted: Fri May 06, 2005 12:14 pm    Post subject: Reply with quote

Jedi Knight

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

How can somebody do it?
The first 100 messages is doable. If the PUTter is running how will someone find the last 100 messages?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PeterPotkay
PostPosted: Sat May 07, 2005 6:48 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

MQINQ the depth, subtract 100 to get n, browse up to n, then start destructive gets.

This will only work if you can guarantee that no more messages will arrive after you find out what n is. Since you can't guarantee that, this is just a bad idea. I suppose if you program had the autority to MQSET the queue to PUT_DISABLED, then MQINQ the depth, then subract 100 to get n, then get the last 100, and then MQSET to PUT_ENABLE the queue, it would work, but now you got a PUT_DISABLED queue. What problems is that going to cause?

Unless you can guarantee that no more mesages will arrive, you should not bother with this design of pulling the last 100.

What are you really trying to do? What's so special about these last 100 messages?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon May 09, 2005 5:50 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I would think that any program that was designed to read through messages with no intention of doing something with them would be a bad design. There is no telling how many CPU cycles you'll be burning to do nothing. If there is something special about these messages, you can consider grouping them together and then getting messages in a group.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
kspranava
PostPosted: Mon May 16, 2005 12:26 am    Post subject: move cursor option Reply with quote

Centurion

Joined: 27 Apr 2003
Posts: 124

Hi All,

Is there any option to move the msg cursor directly to a particular message by giving the msg seq. no. Also, is there any option to trace msgs backwards like MQGMO_BROWSE_PREVIOUS?

Thanks in advance.
Back to top
View user's profile Send private message
bob_buxton
PostPosted: Mon May 16, 2005 1:44 am    Post subject: Re: move cursor option Reply with quote

Master

Joined: 23 Aug 2001
Posts: 266
Location: England

kspranava wrote:
Hi All,

Is there any option to move the msg cursor directly to a particular message by giving the msg seq. no. Also, is there any option to trace msgs backwards like MQGMO_BROWSE_PREVIOUS?

Thanks in advance.


If you know the message id and/or correlid and/or groupid you can specify them as match options with a browse first request and the browse cursor will be positioned at the first matching messages. You could then use browse next without match options to browse sequentially forward from that point.
There are no backwards browse or get options.
_________________
Bob Buxton
Ex-Websphere MQ Development
Back to top
View user's profile Send private message
bob_buxton
PostPosted: Mon May 16, 2005 1:49 am    Post subject: Reply with quote

Master

Joined: 23 Aug 2001
Posts: 266
Location: England

PeterPotkay wrote:
MQINQ the depth, subtract 100 to get n, browse up to n, then start destructive gets.

This wouldn't work - the browse cursor has no effect on destructive gets which will get the first message on the queue.
However a Browse next, Get message under cursor loop for the last hundred should work.
_________________
Bob Buxton
Ex-Websphere MQ Development
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 » How can I get the last 100 messages from a 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.