Failover on Connect

222 views
Skip to first unread message

puberis

unread,
Aug 26, 2014, 12:03:57 AM8/26/14
to stom...@googlegroups.com
I'm trying to connect to an ActiveMQ cluster through the failover transport, but stompest always errors out on the first server if it's not the active node. For instance, assume server3 is the active master in the following code:

config = StompConfig( uri='failover:(tcp://server1:61613,tcp://server2:61613,tcp://server3:61613)?randomize=false' )

st = Stomp( config )
try:
st.connect()
except StompConnectTimeout as e:
logging.error( "Error connecting: %s" % e )
except StompConnectionError as e:
logging.error( "Error connecting: %s" % e )

Always yields:
WARNING:stompest.sync.client:Could not connect to server1:61613 [Could not establish connection [[Errno 111] Connection refused]]
ERROR:stompest.sync.client:Reconnect failed [Reconnect timeout: 0 attempts]
ERROR:root:Error connecting: Reconnect timeout: 0 attempts


Does failover not take place until a connection has been made? I would think it would happen here as well, trying the next URI until one connects or list end is reached. Any ideas?


Thanks!

Aleksandr Sytar

unread,
Aug 26, 2014, 11:04:35 AM8/26/14
to stom...@googlegroups.com


вторник, 26 августа 2014 г., 8:03:57 UTC+4 пользователь puberis написал:
You must set max attempt and delay like this:

default_uri = '''failover:(tcp://%(host)s:%(port)d,tcp://%(host)s:%(port)d)?randomize=%(randomize)s,startupMaxReconnectAttempts=%(startupMaxReconnectAttempts)d,initialReconnectDelay=%(initialReconnectDelay)d,maxReconnectDelay=%(maxReconnectDelay)d,maxReconnectAttempts=%(maxReconnectAttempts)d''' % activemq[
    'stomp'] 


Reply all
Reply to author
Forward
0 new messages