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 API Support » Message Count

Post new topic  Reply to topic
 Message Count « View previous topic :: View next topic » 
Author Message
Sowmya
PostPosted: Wed Feb 04, 2009 11:23 am    Post subject: Message Count Reply with quote

Newbie

Joined: 03 Feb 2009
Posts: 3

HI,

How do get the count of messages from the Queue using .net API.

thanks
Sowmya
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Feb 04, 2009 11:26 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

MQGET each one, and increment a local variable.
Back to top
View user's profile Send private message
Sowmya
PostPosted: Wed Feb 04, 2009 11:31 am    Post subject: Message Count Reply with quote

Newbie

Joined: 03 Feb 2009
Posts: 3

thanks for the reply.

I didnt get your point.

I want to use the TotalCount of messages in the loop and read one by one message data.

Is there a way to get the total number of messages in the queue in .NET.


Thanks
Sowmya
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Feb 04, 2009 11:32 am    Post subject: Re: Message Count Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Sowmya wrote:
I want to use the TotalCount of messages in the loop and read one by one message data.


No.

You don't.

You want to read each message off the queue until you are told that there are no more messages.
Back to top
View user's profile Send private message
Sowmya
PostPosted: Wed Feb 04, 2009 11:34 am    Post subject: Message Count Reply with quote

Newbie

Joined: 03 Feb 2009
Posts: 3

yes that is the goal.Let me know the method name if possible.

thanks
sowmya
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Feb 04, 2009 11:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm sure the documentation is much more authoritative than I am.

Happy Searching, Reading, Thinking and Learning.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 04, 2009 12:26 pm    Post subject: Re: Message Count Reply with quote

Grand High Poobah

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

Sowmya wrote:
yes that is the goal.Let me know the method name if possible.


Either read the documentation or look at the sample code.

(You'll notice none of the sample code counts messages and loops. There's a reason for this. You'll find this reason, along with the answer to your question, has been previously posted on the forum many times if you care to search for it)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
VijayGoparaju`
PostPosted: Thu Feb 05, 2009 12:27 am    Post subject: Reply with quote

Acolyte

Joined: 26 Aug 2008
Posts: 72

Hi Sowmya,

You can use this method:MQC.MQGMO_BROWSE_NEXT
Thanks..
Vijay
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Feb 05, 2009 12:41 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Don't do that.

You don't need to know the depth. Just process the messages with MQGET until MQRC 2033 is returned (which could be on the first attempt if the queue is empty).

Awareness of depth causes problems when messages arrive or leave during your program's execution.

Browsing should only be used for special reasons not in standard applications.

I suppose it might be OK to MQINQ on the depth before starting to process a queue if it's non-zero, but make sure that you then loop until 2033 and don't loop for the depth value (as it may have already changed).
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Feb 05, 2009 1:15 am    Post subject: Reply with quote

Grand High Poobah

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

VijayGoparaju` wrote:
You can use this method:MQC.MQGMO_BROWSE_NEXT


Aside from not doing what the poster wants without other code you've not mentioned, the browse cursor is very inefficient.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 API Support » Message Count
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.