Author |
Message
|
purohit_manoj |
Posted: Mon Jan 05, 2004 1:36 am Post subject: Not able to read message from MQ local Queue. |
|
|
Newbie
Joined: 05 Jan 2004 Posts: 3 Location: Singapore
|
Hi All Experts,
I am using MQ Series, I have created a local queue on the system. This is a production system where everything was ok until recently something new is discovered. I saw that I am able to browse the message from the Q but I am not able to read the mesage from the queue sometimes. It doesnt happen all the time, its just sometimes.
MQMessage message = new MQMessage();
I m using message.readUTF(); is it got to do with this?
What can be the reason? Pls advice.
Manoj Purohit. _________________ Brainbench Top 5 Programmers in Singapore. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 05, 2004 5:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
How do you know it is failing, even sometimes?
Is your code returning an error? Why didn't you post that error, if so? Did you look up in the manuals what that error means?
What do your messages look like? How can we tell whether "readUTF" is the problem or not? Why do you think readUTF might be the problem? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Mon Jan 05, 2004 8:10 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
When you say 'read the message', I take that to mean that you can't get the message? If that is the case, the most common problem that we see in this area is issuing a get by message id or correlation id and not resetting the field. |
|
Back to top |
|
 |
purohit_manoj |
Posted: Tue Jan 06, 2004 7:14 pm Post subject: |
|
|
Newbie
Joined: 05 Jan 2004 Posts: 3 Location: Singapore
|
I am trying to get the message after browsing the message from the queue. Following is the code snipplet..
MQMessage msg = q_mgr.browseMessage(res_q, false);
if (m_engine == null) break;
if (msg!=null)
{
try
{
String res_string = msg.readUTF();
if (res_string!=null && res_string.length()>0)
{
//This part is not executed. I can go and check that there is a message in the queue by running MQ commands.
//Some code here
}
//Some Code here
}
catch()
{//code here}
}
I am not calling msg.clearMessage() can that be a cause??
bower5932: Thanks for ur reply. Can u pls explain what do u mean by "not resetting the field."
Thanks,
Manoj _________________ Brainbench Top 5 Programmers in Singapore. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 07, 2004 5:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
purohit_manoj wrote: |
I am trying to get the message after browsing the message from the queue. Following is the code snipplet..
MQMessage msg = q_mgr.browseMessage(res_q, false); |
How do you know the browseMessage call is succeeding? What happens if this piece of code throws an exception? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
purohit_manoj |
Posted: Wed Jan 07, 2004 7:39 am Post subject: |
|
|
Newbie
Joined: 05 Jan 2004 Posts: 3 Location: Singapore
|
I have some print statement after the browse message and its printing that.
Thanks all for the help, the problem has been solved now.
Actually it had nothing to do with all this.
Thanks for all the valuable advise.
Manoj. _________________ Brainbench Top 5 Programmers in Singapore. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jan 07, 2004 8:17 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
My "resetting the field" comment referred to when you attempt to get a message by ID. In C, the message id/correlation id is filled in after the MQGET. A common mistake was to turn right around and issue a second MQGET using the filled in version of the message id/correlation id. The fields needed to be reset (set to null) so that a second get would get any message and not a specific message (which you had just gotten). |
|
Back to top |
|
 |
|