Posted: Thu Oct 12, 2006 12:10 pm Post subject: Automate recovery for client on 2009 error
Partisan
Joined: 07 Aug 2001 Posts: 386
We have JMS clients doing synchronous wait for messages on the server. If there is any network problem, it will get JMSException with embedded MQRC of 2009.
"com.ibm.mq.MQException: MQJE001: Completion Code 2 Reason 2009"
We want to provide some automatic retry for this error. For example, close the connection and reconnect.
Is there any concern about this kind of retry ? We will limit the retry to 2 or 3 times to prevent it from retrying forever.
I am not a JMS programmer. Is there a method already exist to extract just the reason code from the JMSException so that we can check and do conditional branch to retry?
or I can simply extract the field after reason in the exception message. This will rely on IBM not chnaging the format of the exception message.
The JMS exception will have a Linked Exception, which will be an MQException, which should have a getReasonCode() or some such. _________________ I am *not* the model of the modern major general.
The code to trap the exception is the same as in the manual
:
} catch (JMSException je) {
System.out.println("caught "+je);
Exception e = je.getLinkedException();
if (e != null) {
System.out.println("linked exception: "+e);
}
I then tried
int reacode = e.getReasonCode()
System.out.println("Reason code is "+ reacode);
But get error
cannot resolve symbol
symbol : method getReasonCode()
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