Chapter 6. Writing code that survives failure


This chapter covers

  • Understanding load balancing
  • Installing and configuring HAProxy to load balance Rabbit
  • Writing code that reconnects and intelligently survives failure


Building a RabbitMQ cluster to ensure availability and performance is only half the battle of ensuring a resilient messaging infrastructure. The other half is writing applications that expect node failure and knowing how to reconnect to the cluster when it happens. There are a number of strategies for handling reconnection to the cluster, but the one we’ll focus on is using a load balancer to handle node selection. By using a load balancer you not only reduce the complexity of the failure handling code in your apps, but you ...

Get RabbitMQ in Action: Distributed messaging for everyone now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.