Set Timeout when Solace is not responding
Hi,
Our application uses Solace for publishing messages.
The code looks like this -
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicPublisher topicPublisher = topicSession.createPublisher(myTopic);
topicPublisher.publish(textMessage);
Our application couldn't connect to the solace server due to some connectivity reasons(with which we are not concerned about) and we got the following warnings -
javax.jms.JMSException: Error creating producer - transport error ((Client name: something-abc Local port: -1 Remote addr: something-xyz) - Timeout happened when reading response from the router.)
But the issue is our application waited for 10 mins during this time. Is there any way that our application doesn't wait so much time for getting response from solace.
We had not set any system properties in our application -
SOLACE_JMS_JNDI_CONNECT_TIMEOUT
SOLACE_JMS_JNDI_READ_TIMEOUT
But the default timeout for these is 30s and 10s respectively, then why did our application waited for so much time?
Answers
-
Hi @Mansi ..! Welcome to the Solace Community.
Ok, so if I understand you correctly: your app tried to connect to Solace, but it was down (which you knew), but the app took 10 minutes to throw an exception saying that there was a problem?
I'm curious: what have you configured your reconnection settings to? Is it possible you have your retries configured similar to https://docs.solace.com/Solace-PubSub-Messaging-APIs/API-Developer-Guide/Configuring-Connection-T.htm which gives approximately 5 minutes of retry attempts? If you are using a comma-separated hostlist (for "active" and "standby" brokers), then it is possible the entire reconnection attempt could take 10 minutes before finally giving up.
That's only for reconnections though, which means you would have had a connection before.
Do you have logging enabled/configured? Using log4j or something, you should be able to see any reconnect attempts to the broker.
I've started writing some new samples for JMS, maybe see if you see the same things? https://github.com/SolaceSamples/solace-samples-jms/tree/update-gradle/src/main/java/com/solace/samples/jms/patterns
Or just clone this branch, and give it a try: https://github.com/SolaceSamples/solace-samples-jms/tree/update-gradle
1