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 to get the message depth from MQueue

Post new topic  Reply to topic
 How to get the message depth from MQueue « View previous topic :: View next topic » 
Author Message
shalinithulasi
PostPosted: Thu May 24, 2007 5:21 am    Post subject: How to get the message depth from MQueue Reply with quote

Newbie

Joined: 24 May 2007
Posts: 4

Hi,

I wanted to get the message depth in an MQueue.
I am using the following method to get depth which I got while googling for MQQueue.

MQQueue queue = null;
//Create Q here
int ret=queue.getCurrentDepth();

But I am getting compilation error that method doesnot exist.
I am using MQ Series ver 5.2.
Any idea of the issue?

Shalu
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Thu May 24, 2007 5:44 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Why do you want to know the q depth? If you are going to use it to determine if you should do another MQGET, that is wrong. Do a search here to find out why.

Unless you are writing a monitoring program, apps don't need to know the q depth.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu May 24, 2007 10:44 am    Post subject: Re: How to get the message depth from MQueue Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

shalinithulasi wrote:
I am using MQ Series ver 5.2.


You also want to use a more up to date version.

Though this will not make reading the queue depth in a standard app a good thing to do.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
shalinithulasi
PostPosted: Thu May 24, 2007 11:02 pm    Post subject: get depth of Q Reply with quote

Newbie

Joined: 24 May 2007
Posts: 4

Hi,
My requirement is to get the messages that were there in Q before when my app started..
During one run of app, it should not pick msgs coming simultaneously to the Q. It should pick those msgs during nxt run.
I thought if I know the count, it's easy to iterate that many times only and exit my app.
Guide me if I am wrong.
Shalu
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 25, 2007 12:27 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

This is a bad design - queues should not be used to hold messages. Nor is it too wise to fill the queue while you/re emptying it - imagine what will happen if someone down the line changes the queue from FIFO to priority!

Your app should ideally read the queue until empty. If you have this deadline wierd thing, read the messages under syncpoint until you find one with a put datetime after your app started, then roll it back and stop.

But this is still not a good design
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
shalinithulasi
PostPosted: Fri May 25, 2007 1:06 am    Post subject: Reply with quote

Newbie

Joined: 24 May 2007
Posts: 4

Thanks..
but do you know that getcurrentdepth() fn is avail for MQ ver5.3.
Or is it avail from any later versions?
Back to top
View user's profile Send private message
shalinithulasi
PostPosted: Fri May 25, 2007 1:10 am    Post subject: Reply with quote

Newbie

Joined: 24 May 2007
Posts: 4

Thanks..
but do you know that getcurrentdepth() fn is avail for MQ ver5.3.
Or is it avail from any later versions?
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Fri May 25, 2007 2:12 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

shalinithulasi wrote:
Thanks..
but do you know that getcurrentdepth() fn is avail for MQ ver5.3.
Or is it avail from any later versions?


Yes,

There is method getCurrentDepth() of MQQueue class.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
PeterPotkay
PostPosted: Fri May 25, 2007 5:01 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

shalinithulasi wrote:
Thanks..
but do you know that getcurrentdepth() fn is avail for MQ ver5.3.
Or is it avail from any later versions?

Sigh. You are still going to code it the wrong way, aren't you?

OK, here's a hint why this is bad.

So, you get the current depth, its 100 and you say you are going to do 100 gets. What if some of those 100 messages were expired? What if some were uncommitted? What if some were locked? (you will still do your 100 gets and now risk getting newer messages!)

Bad Design!
_________________
Peter Potkay
Keep Calm and MQ On
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 to get the message depth from MQueue
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.