Yesterday, I stumbled upon what seems to be an ActiveMQ bug and I decided it was finally time to try another JMS broker. It’s been a while now that I want to try HornetQ, former JBoss Messaging 2.0.

The latest release is 2.2.1 and you can grab it over here.

I have this project where JMS access is configured with Spring and all I need is a ConnectionFactory and a DestinationResolver bean to get it working. The documentation of HornetQ is pretty complete as to which jars I need to add my classpath but since I am using Maven for my project of course I thought everything would have been resolved for me.

Well, no. The content of the hornetq-jms-client speaks for itself. Again, the documentation is clear so I was able to get it working quite easily actually. Here’s what I added in my pom to get it working


<dependency>
    <groupid>org.hornetq</groupid>
    <artifactid>hornetq-core-client</artifactid>
    <version>2.1.1.Final</version>
</dependency>
<dependency>
    <groupid>org.hornetq</groupid>
    <artifactid>hornetq-jms-client</artifactid>
    <version>2.1.1.Final</version>
</dependency>
<dependency>
    <groupid>org.hornetq</groupid>
    <artifactid>jnp-client</artifactid>
    <version>2.1.1.Final</version>
</dependency>
<dependency>
    <groupid>org.jboss.netty</groupid>
    <artifactid>netty</artifactid>
    <version>3.2.0.Final</version>
</dependency>

Of course you’ll also need the JMS API if these are not provided to you by the server you are using. The documentation recommends the jboss jms api jar but the one from geronimo will do as well


<dependency>
    <groupid>org.apache.geronimo.specs</groupid>
    <artifactid>geronimo-jms_1.1_spec</artifactid>
    <version>1.0.1</version>
</dependency>

Last but not least, I doubt the only Maven repository where I’ve found these is in your Maven proxy config so you’ll need to add this somewhere


<repository>
    <id>hornetq-repo</id>
    <url>http://repository.jboss.org/maven2-brew</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>

Too bad hornetq jars have no metadata and I’ll hope this will change in the future.

UPDATE: Have a look to HORNETQ-426.