jpwilliams/remit

Add reconnection logic

jpwilliams opened this issue · 2 comments

A client service running remit will currently crash upon losing connection to the RabbitMQ server. This is expected (#70) but highlights the lack of the ability to have a client reconnect to the server without restarting the entire process.

There are a few open-source wrappers for this (amqplib-auto-recovery, amqplib-retry, amqp-connection-manager) but they need investigating to see whether they're viable, how much logic would have to change as a result of using them, if it's pertinent to manage our own solution etc.

Looks like there are quite a few around that help manage reconnecting, but using one of those we'd end up having to add a tonne of reconnection logic across the module too.

amqp-connection-manager looks the best bet. Looks like it's got an interesting system whereby you create and manage individual channels and it has a Proxy set up that buffers actions as you go.

I'll start messing around with that and see where we can get.

I think the complexity here isn't really justified when this lib is geared towards microservices. It's a better bet to just reboot the service than it is to sit trying to reconnect.