aiostomp icon indicating copy to clipboard operation
aiostomp copied to clipboard

Failover possible?

Open madkote opened this issue 5 years ago • 6 comments
trafficstars

hi,

is there failover functionality?

E.g.: https://github.com/jasonrbriggs/stomp.py/blob/010b245bc869381e25895b26d987ca19df1d2a2c/stomp/connect.py#L123

madkote avatar Feb 28 '20 14:02 madkote

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.

pedrokiefer avatar Feb 28 '20 14:02 pedrokiefer

thx for reply.

list of servers would be very useful.

madkote avatar Feb 28 '20 15:02 madkote

it is a loop over tuples of hosts and ports, instead connecting to one host+port.

madkote avatar Feb 28 '20 15:02 madkote

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 ?

pedrokiefer avatar Feb 28 '20 17:02 pedrokiefer

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 retry values - 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.

madkote avatar Mar 05 '20 10:03 madkote

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.

madkote avatar Mar 06 '20 16:03 madkote