You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jydev <jy...@gmail.com> on 2009/05/04 21:24:55 UTC

connection failover using ActiveMQ 5.2

Hello,
I am trying to set up auto-reconnect per 
http://activemq.apache.org/failover-transport-reference.html instruction 
failover:(tcp://primary:61616)?timeout=3000

But for some reason, I am  getting IllegalArgumentException when timeout
attribute is set.  

Caused by: javax.jms.JMSException: Could not create Transport. Reason:
java.lang.IllegalArgumentException: Invalid connect parameters:
{timeout=3000}
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:239)
        at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:252)
        at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224)
        at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172)
        at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:125)
        at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:110)
        at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:81)
        at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
        at
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:461)
        ... 6 more
Caused by: java.lang.IllegalArgumentException: Invalid connect parameters:
{timeout=3000}
        at
org.apache.activemq.transport.failover.FailoverTransportFactory.createTransport(FailoverTransportFactory.java:63)
        at
org.apache.activemq.transport.failover.FailoverTransportFactory.doConnect(FailoverTransportFactory.java:37)
        at
org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51)
        at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80)
        at
org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:237)
        ... 14 more


Here is the connection factory config in Spring config.
    <bean id="jmsRemoteConnectionFactory"
        class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
         <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL"
value="failover:(tcp://${jms.broker.host}:61616)?timeout=3000"/>
            </bean>
         </property>
    </bean>

Any idea why it's not accepting "timeout" parameter?

http://activemq.apache.org/activemq-520-release.html 5.2 release note  says
"The default ActiveMQConnectionFactory brokerUrl now uses the failover
transport."  What does this mean?  Without "failover:(tcp...", dead
connections don't re-reconnect. 

Thank you so much in advance!
-- 
View this message in context: http://www.nabble.com/connection-failover-using-ActiveMQ-5.2-tp23374917p23374917.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: connection failover using ActiveMQ 5.2

Posted by MassDosage <ma...@gmail.com>.
If you read the "instruction" page you will see the last sentence says:

"Timeouts on the failover transport are available since 5.3 version."

That caught me out too. Seems we're going to have to wait for 5.3 for that
one.


-- 
View this message in context: http://www.nabble.com/connection-failover-using-ActiveMQ-5.2-tp23374917p23384501.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: connection failover using ActiveMQ 5.2

Posted by jydev <jy...@gmail.com>.
Looks like timeout parameter has been replaced by maxReconnectAttempts.
-- 
View this message in context: http://www.nabble.com/connection-failover-using-ActiveMQ-5.2-tp23374917p23377412.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: connection failover using ActiveMQ 5.2

Posted by jydev <jy...@gmail.com>.
Reading FailoverTransportFactory.java, I see the code that causes the
exception to occur, but I don't understand the logic.  It seems like this
check is added later.  I don't see the same check in 4.1.2

    public Transport createTransport(CompositeData compositData) throws
IOException {
        Map options = compositData.getParameters();
        FailoverTransport transport = createTransport(options);
        if (!options.isEmpty()) { <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            throw new IllegalArgumentException("Invalid connect parameters:
" + options);
        }
        transport.add(compositData.getComponents());
        return transport;
    }

    public FailoverTransport createTransport(Map parameters) throws
IOException {
        FailoverTransport transport = new FailoverTransport();
        IntrospectionSupport.setProperties(transport, parameters);
        return transport;
    }

I don't see how the options can possibly be empty if it is specified in the
URL.  Am I missing something?  Is there new ways to specifying the options?
-- 
View this message in context: http://www.nabble.com/connection-failover-using-ActiveMQ-5.2-tp23374917p23375575.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.