If you have worked with Java EE or you are willing to work with it, you probably have heard about Apache Active MQ. Since, for some reason, nearly each and every blog post that I have read on JMS and Spring (Including Spring In Action (Third Edition) and Just Spring (First Edition)) are using ActiveMQ. ActiveMQ is also recommended to be used while developing Java EE applications with Spring Framework.
So let us briefly explore what are advantages and disadvantages of using ApacheMQ.
First question that comes to mind is why it is so popular. apparently, you have variety of options as the following list proposes:
- Apache ActiveMQ
- Apache Qpid, using AMQP
- BEA Weblogic (part of the Fusion Middleware suite) and Oracle AQ from Oracle
- EMS from TIBCO
- FFMQ, GNU LGPL licensed
- JBoss Messaging and HornetQ from JBoss
- JORAM, from the OW2 Consortium
- Open Message Queue, from Sun Microsystems
- OpenJMS, from The OpenJMS Group
- RabbitMQ, using AMQP
- Solace JMS from Solace Systems
- SonicMQ from Progress Software
- StormMQ, using AMQP
- Ultra Messaging from 29 West (acquired by Informatica)
- webMethods from Software AG
- WebSphere Application Server from IBM, which provides an inbuilt default messaging provider known as the Service Integration Bus (SIBus), or which can connect to WebSphere MQ as a JMS provider
- WebSphere MQ (formerly MQSeries) from IBM
ActiveMQ seems to be quiet a popular option. As Aron Mulder mentioned in SpringSource webinar (Webinar Slides): it is open-source and community-based (as compared to JBoss MQ), its performance in being able to run standalone, or equally inside another process, application server, or Java EE application, its support for nearly everything JMS requires, and lastly its various extensions that integrates well into other products. Apart from what was mentioned in the Webinar, a key benefit of using ActiveMQ with Spring is that, Spring introduced DefaultMessageListenerContainer object from API 2.0 and with that you only need to define an onMessage method where you can easily enable batch processing.
On disadvantages side, ActiveMQ can decrease performance, if you are not using a connection pool. As JmsTemplate asks for a connection per message and then closes it, therefore can put a huge processing load on the server.