Switching from ActiveMQ to RabbitMQ

sjac picture sjac · Aug 12, 2011 · Viewed 30.3k times · Source

I'm currently using ActiveMQ for my messaging needs; aside from a few db failures, it has worked well. However, I'm at the very least considering trying out RabbitMQ. But before I do, I'd like to understand the following:

  1. In what ways does RabbitMQ differ from ActiveMQ? What does RabbitMQ do better or worse than ActiveMQ?
  2. Comparatively, how easy/difficult is RabbitMQ to configure?
  3. How well integrated is RabbitMQ with Spring?
    • With ActiveMQ, I simply wire a connection factory bean into a JmsTemplate and I use DefaultMessageListener beans to connect queues to their respective handlers. Can I essentially do the same with RabbitMQ?

Answer

David Dossot picture David Dossot · Aug 12, 2011
  1. RabbitMQ is an AMQP broker, while ActiveMQ is a JMS one. I suggest you read the AMQP wikipedia article to get an idea of the concepts used in AMQP, which are different than the ones you're familiar in JMS. One of the main difference is that in AMQP a producer sends to an exchange without knowing the actual message distribution strategy while in JMS the producer targets either a queue or a topic (thus being aware of the type of message routing in place). So it's hard to tell what's done better or worse, as the semantics are very different between JMS and AMQP.

  2. RabbitMQ's queues and exchanges are all configured via the AMQP protocol so a client library allows you to configure all your destinations and their behavior. ActiveMQ requires specific destination configuration because the JMS spec doesn't cover any of the administration side of things. Besides that, RabbitMQ's system configuration is Erlang-esque, while ActiveMQ is usually configured in XML. So you'll have to get used to the {tuple} and <> lovely syntax. RabbitMQ is usually installed with OS packages, while ActiveMQ distributions are archives you drop anywhere (or Maven deps you embed into something else).

  3. Very well :) See Spring AMQP.