Author |
Message
|
gayathri |
Posted: Tue Jun 07, 2005 3:57 am Post subject: getCurrentDepth API in java |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Jun 07, 2005 4:08 am Post subject: |
|
|
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 |
|
 |
gayathri |
Posted: Tue Jun 07, 2005 4:19 am Post subject: getCurrentDepth |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Jun 07, 2005 4:27 am Post subject: |
|
|
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 |
|
 |
gayathri |
Posted: Tue Jun 07, 2005 4:39 am Post subject: getCurrentDepth() API in java |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Jun 07, 2005 5:17 am Post subject: |
|
|
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 |
|
 |
bower5932 |
Posted: Tue Jun 07, 2005 6:00 am Post subject: Re: getCurrentDepth() API in java |
|
|
 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 |
|
 |
PeterPotkay |
Posted: Tue Jun 07, 2005 8:48 am Post subject: |
|
|
 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 |
|
 |
gayathri |
Posted: Tue Jun 07, 2005 7:50 pm Post subject: getCurrentDepth API in java |
|
|
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 |
|
 |
kevinf2349 |
Posted: Wed Jun 08, 2005 5:03 am Post subject: |
|
|
 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 |
|
 |
bower5932 |
Posted: Wed Jun 08, 2005 6:24 am Post subject: |
|
|
 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 |
|
 |
gayathri |
Posted: Wed Jun 08, 2005 11:56 pm Post subject: getCurrentDepth |
|
|
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 |
|
 |
mqmhr |
Posted: Thu Jun 09, 2005 12:17 am Post subject: |
|
|
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 |
|
 |
bower5932 |
Posted: Thu Jun 09, 2005 1:59 am Post subject: |
|
|
 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 |
|
 |
titus |
Posted: Fri Jun 10, 2005 9:47 am Post subject: |
|
|
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 |
|
 |
|