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 » CurrentDepth()

Post new topic  Reply to topic Goto page Previous  1, 2
 CurrentDepth() « View previous topic :: View next topic » 
Author Message
cvrachak
PostPosted: Wed Nov 16, 2005 10:22 am    Post subject: Reply with quote

Novice

Joined: 06 Jul 2002
Posts: 17

private void test()
{
MQQueueManager mqQMgr = null;
MQQueue mqQueue = null;
try
{
mqQMgr = new MQQueueManager( textBox1.Text );

mqQueue = mqQMgr.AccessQueue( textBox2.Text,
MQC.MQOO_FAIL_IF_QUIESCING |
MQC.MQOO_INPUT_SHARED |
MQC.MQOO_INQUIRE
);
int iQDepth = 0;

try
{
iQDepth = mqQueue.CurrentDepth;
label1.Text = iQDepth.ToString();
}
catch ( MQException exp )
{
string str = exp.Message;
label1.Text = exp.Message;
}

}
catch (Exception ex )
{
Console.WriteLine(ex.Message);
}
}
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Nov 16, 2005 10:24 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Okay, but the code doesn't show either Peter's or my suggestion (MQOO_SET or use ObjectQMgrName)
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
cvrachak
PostPosted: Wed Nov 16, 2005 3:49 pm    Post subject: Reply with quote

Novice

Joined: 06 Jul 2002
Posts: 17

Hey Wayne,

I have added MQC.MQOO_SET in the AccessQueue call it throws the 2068 error.

I have added the QMgrName,"","" after the option param in AccessQueue, it still gives the same 2068 error

I am using MQ 5.3 CSD 7
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Nov 16, 2005 4:00 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

One last suggestion, what happens of you do either one of those two things and don't specify MQOO_INPUT_SHARED?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
cvrachak
PostPosted: Tue Nov 22, 2005 3:27 pm    Post subject: Reply with quote

Novice

Joined: 06 Jul 2002
Posts: 17

I am really sorry for not updating this list. I was referring to 1.0.0.2 version of the AMQMDNET.dll, the installed version on my box was 1.0.0.3, once I started using 1.0.03, everything is fine.

Thanks again for your support.
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Mar 01, 2006 4:07 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

try this:
Quote:
mqrc 2068
then tell us what you've doen to try and figure out what the problem is .....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Jaywant
PostPosted: Mon Nov 03, 2008 6:43 am    Post subject: Unable to get the current depth Reply with quote

Newbie

Joined: 03 Nov 2008
Posts: 3

PeterPotkay wrote:
You have to open it with the SET and INQUIRE options if it is a cluster queue if you want to get the depth.


I have Clustered Mqs now. Earlier with P2P Mqs I was able to find the current depth and hence the code was running fine.

Now with the clustered MQs I am facing difficulty in getting the current depth. I even tried using SET option.
I am using .Net API.

PFB the code used -

mqQ = mqQManager.AccessQueue(sQueue,MQC.MQOO_INQUIRE + MQC.MQOO_SET + MQC.MQOO_INPUT_SHARED + MQC.MQOO_BROWSE);

//Pick all messages in the Queue
while (mqQ.QueueType == MQC.MQQT_LOCAL && mqQ.CurrentDepth > 0)
{
//MQ Message
MQMessage mqMsg = new MQMessage();
//Get Message
mqQ.Get(mqMsg, mqMsgOpts);
if (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) == 0)
{
sbMessage.Append(mqMsg.ReadString(mqMsg.MessageLength));
CreateMessage(sbMessage,iMQId);
}
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 03, 2008 10:53 am    Post subject: Re: Unable to get the current depth Reply with quote

Grand High Poobah

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

Jaywant wrote:
PeterPotkay wrote:
You have to open it with the SET and INQUIRE options if it is a cluster queue if you want to get the depth.


I have Clustered Mqs now. Earlier with P2P Mqs I was able to find the current depth and hence the code was running fine.

Now with the clustered MQs I am facing difficulty in getting the current depth. I even tried using SET option.
I am using .Net API.


Why is your application trying to get the depth? As has been discussed many times on this forum there's never a need for an application to do that.

When you say "having difficulty" do you want to give us some more details? Are you getting error codes or is it just not doing what you think it should? Because if it's the latter, I'm not surprised.

The Search Function Is Your Friend.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Jaywant
PostPosted: Mon Nov 03, 2008 7:21 pm    Post subject: Re: Unable to get the current depth Reply with quote

Newbie

Joined: 03 Nov 2008
Posts: 3

Vitor wrote:
Jaywant wrote:
PeterPotkay wrote:
You have to open it with the SET and INQUIRE options if it is a cluster queue if you want to get the depth.


I have Clustered Mqs now. Earlier with P2P Mqs I was able to find the current depth and hence the code was running fine.

Now with the clustered MQs I am facing difficulty in getting the current depth. I even tried using SET option.
I am using .Net API.


Why is your application trying to get the depth? As has been discussed many times on this forum there's never a need for an application to do that.

When you say "having difficulty" do you want to give us some more details? Are you getting error codes or is it just not doing what you think it should? Because if it's the latter, I'm not surprised.

The Search Function Is Your Friend.


I am using Current depth to control the WHILE loop used for fetching the messages from Queue.

If I don't check the depth then in case of empty Queue I get error 2033.

However, when I use current depth I get error 2068.

If there is alternative way of fetching the messages please let me know.
Thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 03, 2008 8:22 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

jaywant wrote:
I am using Current depth to control the WHILE loop used for fetching the messages from Queue.

If I don't check the depth then in case of empty Queue I get error 2033.

However, when I use current depth I get error 2068.

If there is alternative way of fetching the messages please let me know.
Thanks

Yes there is an alternative. Don't check the depth and read until you get a 2033 return code which means no message available for the selection criteria.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Jaywant
PostPosted: Mon Nov 03, 2008 10:47 pm    Post subject: Reply with quote

Newbie

Joined: 03 Nov 2008
Posts: 3

fjb_saper wrote:
jaywant wrote:
I am using Current depth to control the WHILE loop used for fetching the messages from Queue.

If I don't check the depth then in case of empty Queue I get error 2033.

However, when I use current depth I get error 2068.

If there is alternative way of fetching the messages please let me know.
Thanks

Yes there is an alternative. Don't check the depth and read until you get a 2033 return code which means no message available for the selection criteria.


Are you aware of any better method?
This method of catching the errors does seem to be the best.
This is more on exception handling front.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Nov 04, 2008 4:19 am    Post subject: Reply with quote

Grand High Poobah

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

Jaywant wrote:
Are you aware of any better method?


Reading until empty (rc 2033) is considered the best method. If you search the forum as I suggested, you'll see a lot of discussion around this, and various alternatives.

You'll also find why using current depth is unreliable in this context.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Nov 04, 2008 3:06 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9469
Location: US: west coast, almost. Otherwise, enroute.

This may help: think of a queue of messages as a file in the filesystem. Your application doesn't need to know how much data to read from a file; it merely reads until the end-of-file indicator is passed to the application.

In WMQ-speak (with no selection criteria), 2033 returned from an MQGET is like end-of-file. With selection criteria, 2033 either means no message met the criteria OR there were no messages in the queue.

Queue depth doesn't tell the application if any of the messages will satisfy an MQGET. For example, messages that are not yet comitted by the MQPUTping application add to queue depth, but will not be MQGETable.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ API Support » CurrentDepth()
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.