postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Add ability to force a reconnect on heartbeat timeout #424

Closed chriswiggins closed 8 years ago

chriswiggins commented 8 years ago

Introduces a heartbeatForceReconnect option, when true will force the library to reconnect on a heartbeat failure.

Looks like this is needed based on other issues and I needed it for a project as well.

postwait commented 8 years ago

Can you describe how you've tested this?

chriswiggins commented 8 years ago

Yeah sure sorry @postwait - we have a clustered RabbitMQ setup (3 hosts in HA) and HAProxy sitting in front of it. I've been testing by adding an iptables rule on the HAProxy server, dropping packets from HAProxy to a specific cluster member that the client is connected to. After 2 * heartbeat, the client would sometimes reconnect and sometimes not. By adding this option, (and setting it to true) the error is always thrown and the client reconnects to HAProxy, which in turn directs the TCP request at a host that it can reach.

Does that make sense? I wasn't sure how else to create a test scenario for it