Previously I wrote about using SMQueue to create some simple consumers and producers for message queues. I also wrote about setting up a high availability message store. In the case of a failure the message queue will turn the slave node into the master. Unfortunately the producer and consumer I created will forever try to reconnect to the now-dead ex-master node.

Using smqueue 0.1.0 (which was produced when I created the simple producer and consumer) it's trivial to add failover capabilities to the clients. Where the SMQueue instance is created simply add another key, secondary_host, to the configuration and point it to the second broker.

queue = SMQueue(
  :name => "/queue/numbers.ascending",
  :host => "",
  :secondary_host => "",
  :adapter => :StompAdapter

I think that the plan is to support more than two broker nodes and support for failover strategies into future versions of SMQueue.

written by
Disagree? Found a typo? Got a question?
If you'd like to have a conversation about this post, email I don't bite.
You can verify that I've written this post by following the verification instructions:
curl -LO
curl -LO
gpg --verify using-smqueue-with-message-queues-that-failover.html.orig{.asc,}