Posted: Sun Sep 23, 2007 9:47 pm Post subject: findind Depth and reading the messages in a Loop
Novice
Joined: 15 Jun 2006 Posts: 20 Location: INDIA
Hi All,
I have a requirement of reading the messages from a Queue by finding the depth and reading all the messages one by one using loop until the depth becomes zero( i mean only with intial depth ). This is we like we run in Batch job .
Iam able to fine the depth and read theQueue but it is reading first message and for the next message its throwing An MQException occurred in MQget method with completion code 2 and reason code 2033.
please could any one suggest me in using any particular options or any other way to follow
is your second read with a clean message descriptor? if you reuse the storage, the message descriptor that was filled from the first get is used as input for the second get (yes, there are input fields in the message descriptor). if you do not clean msgid and correlid mq will try to get a message with matching ids, which may not be there... _________________ Regards, Butcher
This is the wrong way to build a loop for MQ. Because there's all kinds of ways that queue depth could be different than the number of messages that are available for you to GET.
You should be writing your loop to stop once you get a 2033.
As Herr Butcher says, you also need to make sure you are cleaning or creating a new or otherwise setting the MQMD for each GET so that you don't match things you don't want to match. _________________ I am *not* the model of the modern major general.
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