ActiveMQ timeout at connection

Viewed 20313

I have the following problem: I try to connect to an ActiveMQ broker (which is now down) using the following piece of code

connectionFactory = new ActiveMQConnectionFactory(this.url + "?timeout=2000");
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
LOGGER.info("Connected to " + this.url);

The problem is that the timeout does not have any effect

connection.start()

is blocked forever. I inspected ActiveMQ log and found the following info:

2013-12-20 01:49:03,149 DEBUG [ActiveMQ Task-1] (FailoverTransport.java:786) - urlList connectionList:[tcp://localhost:61616?timeout=2000], from: [tcp://localhost:61616?timeout=2000]
2013-12-20 01:49:03,149 DEBUG [ActiveMQ Task-1] (FailoverTransport.java:1040) - Connect fail to: tcp://localhost:61616?timeout=2000, reason: java.lang.IllegalArgumentException: Invalid connect parameters: {timeout=2000}

The timeout parameter is specified here http://activemq.apache.org/cms/configuring.html

Has anybody any idea how to pass timeout argument to ActiveMQConnectionFactory? Or how to set a timeout for connection.start() ? Thank you!

Update: I found this on Stackoverflow: ActiveMQ - CreateSession failover timeout after a connection is resumed . I tried it but the following exception is thrown:

javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {transport.timeout=5000}
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)

I use ActiveMQ 5.8.0 from maven repo

1 Answers
Related