|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JMS application send message to MQ problem:reason 2009 |
« View previous topic :: View next topic » |
Author |
Message
|
terry902 |
Posted: Wed Jul 15, 2015 12:26 am Post subject: JMS application send message to MQ problem:reason 2009 |
|
|
Novice
Joined: 10 Oct 2014 Posts: 15
|
...
MQQueueConnection connection = (MQQueueConnection)mcf.createQueueConnection(mqUsername,mqPassword);
connection.start();
...
queueSession = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
queue = queueSession.createQueue(MQClientContext.OUTBOUND_QUEUE);
queueSender = (MQQueueSender) queueSession.createSender(queue);
...
queueSender.send(Message, DeliveryMode.PERSISTENT, 3, 0);
...
-----------------------------------------------------------------------------
Sometimes 2009(MQRC_CONNECTION_BROKEN) exception occurs when execute the line queueSender.send(...) because of the network.
My question is: I want to resend message in my appliction when the network is not good, I try to Re-initialize queueSession,queue,queueSender only, but not the connection. Is that enough? Or I must Re-initialize the connection too? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 15, 2015 4:19 am Post subject: Re: JMS application send message to MQ problem:reason 2009 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
terry902 wrote: |
My question is: I want to resend message in my appliction when the network is not good, I try to Re-initialize queueSession,queue,queueSender only, but not the connection. Is that enough? Or I must Re-initialize the connection too? |
If the connection's broken, it's broken, you need to reestablish it. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 15, 2015 5:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Before trying to reestablish the connection, try to close it. You may well get hit by an exception there. But if the network is good again it might just free the resource.
Regardless your resource is in no valid state to continue working with it... so the close is just a way to attempt to release it correctly...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
terry902 |
Posted: Thu Jul 16, 2015 1:03 am Post subject: |
|
|
Novice
Joined: 10 Oct 2014 Posts: 15
|
In my test, I did not reestablish the connection. After more than 4 hours, the application re-sent the message successfully. So I confused now. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jul 16, 2015 4:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
terry902 wrote: |
After more than 4 hours, the application re-sent the message successfully. |
After more than 4 hours, the default connection timeout will have expired and the application will reestablish the connection by itself.
Our answers were predicated on the assumption that when you said "resend the message", you meant "resend the message at or about the same time I originally wanted to send it".
If you're prepared to wait for the various network and system components to time out, then no you don't need to reinitialize the connection. Eventually the stack will do it for you. Eventually.
Most of us have more affirmative SLAs than that, hence the advice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|