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 » Error handling after each MQ API call

Post new topic  Reply to topic
 Error handling after each MQ API call « View previous topic :: View next topic » 
Author Message
ydsk
PostPosted: Fri Mar 16, 2007 10:16 am    Post subject: Error handling after each MQ API call Reply with quote

Chevalier

Joined: 23 May 2005
Posts: 410

Hi,

We have more than 200 C/C++ Windows clients connecting to a single MQ qmgr on AIX.

All the clients do a PUT to a queue X, and then indefinitely wait and do a GET from the other queue Y on the AIX qmgr.

The same exact code runs on all the 200 + clients. I don't have any threading issues - all are single threaded.

I am looking for some guidance / samples on handling errors immediately after an API call , in fact after every MQ API call in the C/C++ client.

I think we first check for the Completion Code CC, and then the Reason Code RC after every API call.

Just before opening queue X, the OPEN OPTIONS we gave are:
MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING

Just before opening queue Y, the OPEN OPTIONS we gave are:
MQOO_INPUT_SHARED + MQOO_FAIL_IF_QUIESCING

After each of the MQOPEN calls above we are planning to do a check as follows:
if ( CC == MQCC_FAILED)
if (RC == ..... )

My questions are:
(1) Is it enough if I check for CC == MQCC_FAILED ?? Or do I need to check for any other completion codes ?
(2) What all RC values do I need to check ? I think there are too many of them, and I am not sure which ones to check for. Pls help.

Again, after the OPEN calls, we are doing a PUT to queue X without any explicit PutMessageOptions - using the defaults.

Later we are doing a GET from queue Y with these GetMessageOptions:
MQGMO_WAIT | MQGMO_FAIL_IF_QUIESCING

My questions here again are:
(3) Do I need to use any other PUT/GET message options here ?? I think it depends on the specific application but I am looking for some general guideline.
(4) Do I need to do the same error checking with CC and RC here ? Can somebody please suggest the different values of CC and RC for PUT / GET ?

Appreciate any links ( to any sections of Appl prog guide / reference ) or any other suggestions from your experience.

Thanks in advance.

regds,
ydsk.
Back to top
View user's profile Send private message
dhanaraj
PostPosted: Fri Mar 16, 2007 10:42 am    Post subject: Reply with quote

Voyager

Joined: 10 Aug 2004
Posts: 92

1.CC == MQCC_FAILED i think its enough for checking the cc
ex: if (OpenCode == MQCC_FAILED) {
printf("XXXXXXXXXXXX \n");
}

2. you have to display the RC like
if (Reason != MQRC_NONE) {
printf("XXXXXXXXXXX reason code %ld\n", Reason);
}

3. MQGMO_DEFAULT
4. Yes

I think these ans may helpful for you.

Thanks
Anand
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Mon Mar 19, 2007 1:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

There are some reason codes which may require special handling. For instance 2033 is a message not found exception, while despite being a failure may simply indicate a) your programme's finished or b) you need to wait a bit longer. Another example is 2009 (client connection gone funny) which indicates your program needs to reestablish connecivity.

My tip - search the forum for reason code discussions. Make sure your code correctly handles the commonly discussed ones.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
tleichen
PostPosted: Wed Mar 21, 2007 7:04 am    Post subject: Reply with quote

Yatiri

Joined: 11 Apr 2005
Posts: 663
Location: Center of the USA

Also, if you check for CC==MQCC_FAILED, this leaves out the return codes that are classified as MQCC_WARNING! IMHO, you should code for CC != MQCC_OK. And as Vitor pointed out, some individual codes need to be dealt with.
_________________
IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Error handling after each MQ API call
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.