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 » MQ_Wait is getting reset after reading first message

Post new topic  Reply to topic Goto page Previous  1, 2
 MQ_Wait is getting reset after reading first message « View previous topic :: View next topic » 
Author Message
bruce2359
PostPosted: Wed Nov 10, 2010 2:22 pm    Post subject: Reply with quote

Poobah

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

Your code only checks for 2033, 2161. What about the myriad of other possible exceptions?

Quote:
if (e.reasonCode == 2033)
{
log.logTrace(threadId,"Exception While reading empty Queue: "+requestQueue);
}
else
{
log.logError(2010, "Error retrieving MQ Message from queue");
throw new MQAdapterException(this, e.getMessage());

Why do you log 2010 if the RC is not 2033?
_________________
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
satyaannareddy
PostPosted: Thu Nov 11, 2010 12:30 am    Post subject: Reply with quote

Newbie

Joined: 09 Nov 2010
Posts: 9

Yes the queue was really empty and I am testing this with only one message and that message is already consumed.

Also its not getting the too big for buffer as I mentioned earlier the same message are working fine if I am initializing the GMO and waitInterval again in the waitMQ() method.

for us all other MQ reason codes are not very important as we dont need to do any processing based on them (that includes CONN failures etc.,)

but still I had added them and tried with that as well.
and as you can see from the error log the prog is catching the 2033 as expected but the only and main concern is not sure why the GMO options are reset.
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Thu Nov 11, 2010 2:21 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

i only know very little basics of java, so please bare with me if i am totally wrong here.. but from your code snipped you are calling


Quote:
String requestMsg = waitForMsgFromMQ();


to read a message. but the code you posted then is

Quote:
private String waitMQ() throws MQAdapterException


waitMQ <> waitForMsgFromMQ ?!? where (and how) is that waitForMsgFromMQ coded?

again, if thats totally stupid please ignore or educate me so i understand more java
_________________
Regards, Butcher
Back to top
View user's profile Send private message
satyaannareddy
PostPosted: Thu Nov 11, 2010 2:46 am    Post subject: Reply with quote

Newbie

Joined: 09 Nov 2010
Posts: 9

thats a nice find

I had changed the method name as well thats my mistake not to correct that.

by the way this is my first work on Java in over 8 years please do educate me if there is anything wrong in the code snippet there.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 11, 2010 11:09 am    Post subject: Reply with quote

Grand High Poobah

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

satyaannareddy wrote:
thats a nice find

I had changed the method name as well thats my mistake not to correct that.

by the way this is my first work on Java in over 8 years please do educate me if there is anything wrong in the code snippet there.


Are you sure your gmo options are returning unchanged from the get call?
You may have to use an additional variable (defined outside of the loop) that you initialize with your gmo variable at the beginning of each loop and that you pass to the call.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Sun Nov 14, 2010 6:49 am    Post subject: Reply with quote

Poobah

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

Quote:
for us all other MQ reason codes are not very important as we dont need to do any processing based on them (that includes CONN failures etc.,)

Each MQI call has a set of possible ReasonCodes that may arise. Some RCs are possible for all MCI calls.

Your application code needs to deal with any/all possible ReasonCodes, whether you believe they are important or not. RCs are the only way an application can determine if a call was successful or not , and more importantly, why a call failed.

Quote:
...but still I had added them and tried with that as well.

What do you mean by them? Be specific. With what results?

At the very least, your app should catch all remaining RCs that you didn't expect; and display these results in your output.
_________________
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
fjb_saper
PostPosted: Sun Nov 14, 2010 9:29 am    Post subject: Reply with quote

Grand High Poobah

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

MQ return codes are the basics for troubleshooting a problem.
They will at the very least, point you in the right direction (network problems), and at the best, tell you exactly what the problem is (queue inhibited etc...).

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Sun Nov 14, 2010 9:40 am    Post subject: Reply with quote

Poobah

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

satyaannareddy appears to be new to the (mq) development process; and doesn't understand the need (best-practice requirement) to catch all CCs and RCs.

As is typical to new-to-mq developers, satyaannareddy has chosen to take the easy way, and/or to ignore CompletionCodes and ReasonCodes that don't seem to be relevant to the task at hand.

Likely it's one of the CCs/RCs that were not caught that is hiding the underlying cause of the symptom(s).
_________________
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
good_bee
PostPosted: Mon Nov 15, 2010 7:51 am    Post subject: Reply with quote

Newbie

Joined: 15 Nov 2010
Posts: 5

as fjb_saper has rightly pointed earlier in his post you may need to.

Code:
You may have to use an additional variable (defined outside of the loop) that you initialize with your gmo variable at the beginning of each loop and that you pass to the call.
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 » MQ_Wait is getting reset after reading first message
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.