aiostomp
aiostomp copied to clipboard
Failover possible?
hi,
is there failover functionality?
E.g.: https://github.com/jasonrbriggs/stomp.py/blob/010b245bc869381e25895b26d987ca19df1d2a2c/stomp/connect.py#L123
It supports automatic reconnecting, but there is no support for a list of servers. I think it's simple to extend the reconnect code add this functionality though.
thx for reply.
list of servers would be very useful.
it is a loop over tuples of hosts and ports, instead connecting to one host+port.
Maybe extracting the reconnect logic to another class, and make it composable, so one can have different heuristics for reconnection, like:
- retry forever on one server (default)
- try first server, failover to second server (failover strategy)
- try first server, retry once, try second server, retry once (failover with retry strategy)
- ...
Sounds good to you ?
Hi @pedrokiefer , thank for your reply.
- retry forever on one server -> should be customizable -1, .., n == infinite to N
- failover -> yes, it sounds good. There should be then two
retryvalues - for retry on server and retry failover. Whereby, I personally, would do only one attempt to one of the servers and go to the next in case of failure -> interest here is to find a server asap.
Are you going to implement this soon? otherwise I can also leave with my customization.
when implementing failover be aware of following behaviour with ActiveMQ in cluster mode:
- connections are only acceptable to the master
- when connection to a slave, the connection is accepted, but slave disconnects it after some short period of time.