VirtuOz/smart-router — pull request #12 by sbellone (2013-04-03 17:16:03+00:00)
Title: HA for rabbitMQ

The first commit is about handling the following case:
- Restart HAProxy
- Sockets are disconnected, smart-router tries to unsubscribe from queues. It fails because connection to RabbitMQ is closed.
- HAProxy is restarted, smart-router is reconnected:
- sockets are reconnected, they reconnect to the Queue and resubscribe
- amqp handle the reconnection, and since our unsubscribe has failed, it resubscribe to the queues it has in memory
- --> we have multiple consumers for a queue.

The second commit is about adding a cron task which delete queues which don't have any connected actors since some time.
Each time we unsubscribe from a queue, I check how many actors are still active. When the last actor unsubscribe, I mark the queue as delete and I destroy it few minutes later if the actor has not reconnected.