How can I ensure that a message can always reach a suitable queue even if the RabbitMQ node which I’m sending to crashes?

0
Posted

How can I ensure that a message can always reach a suitable queue even if the RabbitMQ node which I’m sending to crashes?

0

At the risk of sounding pedantic, you could wait for the dead node to recover from disk. In other words, RabbitMQ provides “eventual delivery” out of the box. If you want to persist more reliably than with a single disk then use a RAID or a SAN. The problem with using a single node is the time it takes to recover the node and the cost (if any) of the client reconnection. The time to recover is partly influenced by how much state must be recovered and partly by the size of the unavailability window that your application can tolerate. Many applications don’t like to wait more than (say) 1ms, 10ms or 50ms before they can send their message. In this case, you will typically want to send a message _before_ the crashed node has been able to recover. You can achieve this in two ways: • You don’t care about replicating state and can use any other queue as a ‘suitable queue’. This is easy – just make sure the right consumers and routes are wired up. • You do care about replicating state. Then y