Wednesday, 20 June 2012

Using Apache ActiveMQ in Glassfish

In our recent Java Messaging with JMS and MDB training course, we used Glassfish to send and receive messages using JMS.

The course covers the important topics of messaging, but one restriction was that the default message broker in Glassfish is lacking some of the features that many of the leading message brokers offer.

The big example is that in the chapter on MDB transactions, we have a message return to the queue if the MDB throws an exception. This allows us to "retry" an operation, say if an external system is unreliable.

That's great, and we get that working in the course, but the trouble is that the message immediately gets redelivered. So we end up retrying the operation straight away. What I really wanted was to delay the message redelivery by say an hour, so that the external system has time to recover.

Not possible in the default message broker in Glassfish. So it would be a good exercise to change the default broker. A good choice is Apache ActiveMQ, one of the most feature rich brokers in existence.

This excellent blog post from Sven Hafner describes how to do this - if you've followed our course and want to try this out, do let me know how you get on!

No comments:

Post a Comment