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 » General Discussion » getCurrentDepth API in java

Post new topic  Reply to topic Goto page 1, 2, 3  Next
 getCurrentDepth API in java « View previous topic :: View next topic » 
Author Message
gayathri
PostPosted: Tue Jun 07, 2005 3:57 am    Post subject: getCurrentDepth API in java Reply with quote

Apprentice

Joined: 07 Jun 2005
Posts: 36

Hi,

What is the starting value of the getCurrentDepth method ? After putting message in the queue I try to find the number of messages in the MQ. It always shows a number less than actual number of messages written.

For eg. if I write 5 messages the getCurrentDepth shows 4.

If I write a single messages it shows a count of zero.

Thanks in advance for the help.

Gayathri
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 07, 2005 4:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Why are you trying to use this method? What are you trying to accomplish?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
gayathri
PostPosted: Tue Jun 07, 2005 4:19 am    Post subject: getCurrentDepth Reply with quote

Apprentice

Joined: 07 Jun 2005
Posts: 36

Hi jeff,

I am writing the messages in the MQ in the Sender application.

At the receiving end I read the message and I am creating an XML file for each message read.

But if I write a single message and try to find out the number of messages in the queue it shows zero.

The problem is "Only the 1st message is getting discarded". If i write 5 messages only 4 messages are getting written.

Gayathri
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 07, 2005 4:27 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, use something other than your own code to check the queue depth, first.

Second, make sure you are using or not using syncpoint properly, and aren't leaving an uncommitted message.

Third, look at the samples at http://www.developer.ibm.com/isv/tech/sampmq.html and see what they are doing differently.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
gayathri
PostPosted: Tue Jun 07, 2005 4:39 am    Post subject: getCurrentDepth() API in java Reply with quote

Apprentice

Joined: 07 Jun 2005
Posts: 36

Hi jeff,

Would you please explain it? Should I make an explicit commit after I write messages in the queue.

Why only the first message is discarded?

I have already checked the getCurrentDepth with another sample.

1) If I put a single message in the sender application and try to read at the receiver end error code 2033 is thrown which implies there are no messages in the queue. getCurrentDepth() returns 0. It should return 1 in this case.

2)If I write 5 messages -> getCurrentDepth() returns 4. In this case it should return 5.

Is the starting index of getCurrentDepth is zero or 1.

Kindly clarify


Gayathri.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 07, 2005 5:17 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

getCurrentDepth should return the actual number of messages on the queue.

If you are losing the first message, you are either not actually putting it, or getting but not processing it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Jun 07, 2005 6:00 am    Post subject: Re: getCurrentDepth() API in java Reply with quote

Jedi Knight

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

gayathri wrote:
If I put a single message in the sender application and try to read at the receiver end error code 2033 is thrown which implies there are no messages in the queue. getCurrentDepth() returns 0. It should return 1 in this case.


If you were unable to get the message, then my guess would be that the getCurrentDepth() call is correct and that your message is probably stuck in an uncommitted unit of work.

Are you sure that your put actually worked?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
PeterPotkay
PostPosted: Tue Jun 07, 2005 8:48 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Or the message is expired. That to will report in depth, but not be retrievable.

It is a bad design to worry about the depth of the queue. Just open the queue, and keep reading it until there are no more available messages.

Leave the queue depth monitoring to, um, the monitoring tools!
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
gayathri
PostPosted: Tue Jun 07, 2005 7:50 pm    Post subject: getCurrentDepth API in java Reply with quote

Apprentice

Joined: 07 Jun 2005
Posts: 36

Hi,

My "PUT" call is successful. But I am getting the queue depth as 0 even after putting a single message.

I also tried with
queue.put(sendMessage, putOptions);
qMgr.commit();
System.out.println("Queue depth:" + queue.getCurrentDepth());

Anything wrong in this.

Gayathri
Back to top
View user's profile Send private message
kevinf2349
PostPosted: Wed Jun 08, 2005 5:03 am    Post subject: Reply with quote

Grand Master

Joined: 28 Feb 2003
Posts: 1311
Location: USA

Quote:
My "PUT" call is successful. But I am getting the queue depth as 0 even after putting a single message.


Which makes it sound even more like it is syncpointing that is giving you the issue.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Jun 08, 2005 6:24 am    Post subject: Reply with quote

Jedi Knight

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

I'd suggest that you use the amqsput and amqsbcg programs to test your current depth. The amqsput will put the message immediately (ie, no unit of work). amqsbcg will browse the queue to show exactly how many messages are there. Once you've done this, you can look at what might be going on.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
gayathri
PostPosted: Wed Jun 08, 2005 11:56 pm    Post subject: getCurrentDepth Reply with quote

Apprentice

Joined: 07 Jun 2005
Posts: 36

Hi,

I donot have MQServer installed in my system. The server is in a different location.

What would I do in this case. If problem is with SYNC POINT how do I rectify that. Shud I set SYNCPOINT options in Put message options.

Gayathri
Back to top
View user's profile Send private message
mqmhr
PostPosted: Thu Jun 09, 2005 12:17 am    Post subject: Reply with quote

Centurion

Joined: 28 Dec 2004
Posts: 105

Some wild guesses ... Is there a program at the server end waiting on this queue and picking up the first message only? Is this queue enabled for triggering of any sort?
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Jun 09, 2005 1:59 am    Post subject: Reply with quote

Jedi Knight

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

If there is a server reading the queue, you should be able to see something in the IPPROCS of the display queue. You could also see if the queue is triggered so that the server only starts when a message arrives.

If you aren't already playing with a dummy queue, I'd suggest doing it. It should help avoid some of the above mentioned things from being your problem.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
titus
PostPosted: Fri Jun 10, 2005 9:47 am    Post subject: Reply with quote

Novice

Joined: 14 Oct 2002
Posts: 23

You are seeing one message less because it may never be committed that message.
After your last put , you need to close the queue and open again and get the current depth.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum Index » General Discussion » getCurrentDepth API in java
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.