I am new to RabbitMQ and Bunny, so please excuse me if I've fundamentally misunderstood something, or if my assumptions are bad. My scenario is this: I have RabbitMQ server which is used for broadcasting events from a legacy line-of-business application, when certain entities get updated. And I have a Rails application which consumes these events in order to bust caches of these entities. I more or less have this working. But I foresee an issue if the consumer loses its connection, for example if the RabbitMQ server needs to be restarted: No events will be received for any updates that happen while the connection is down. This does not necessarily need to pose a big problem if the Rails app can somehow be made aware that it is currently not receiving events. As long as it is aware that it currently potentially missing events, it can bypass caches until the connection is re-established. When the connection is regained, it can empty the caches and start repopulating them. If it is unaware however, I risk stale caches. My concrete problem is how to become aware of the lost connection. Looking through the source code of Bunny, it seems like my only option is to disable automatic connection recovery and handle it myself. Which is ultimately not the world's biggest problem, but I would still prefer to Bunny's auto recovery mechanism, as I have more confidence it its ability to not leak resources and re-establish the topology correctly as it recovers. What I had hoped existed was something like the Java RabbitMQ library's
RecoveryListener which does exactly what I want: It receives notification when the connection is lost, and again when the connection is regained.
I would be very curious to know how other people solve this issue, as I can't imagine I'm the only one who has it.