hello world!
Published: March 31, 2013

Amazon Web Services SQS in Grails with Spring JMS

Amazon Web Services SQS in Grails with Spring JMS

I recently needed a quick and simple queue implementation for a Grails project but didn't want the hassle of maintaining an extra application like ApacheMQ or RabbitMQ.

Since this Grails project was already to be housed in Amazon EC2 I decided to pursue the use of AWS's SQS (Simple Queue Service).

Although some Grails SQS plugins already existed, none provided the ease of functionality that the the ApacheMQ and the Grails JMS plugin would.

After a little internet research I came across the Nevado JMS library that included a Spring JMS Provider for AWS SQS.

Once wired it up, it worked perfectly.

I started by including the required dependencies in my grails-app/conf/BuildConfig.groovy

And then configured the Nevado JMS Provider in my grails-app/conf/spring/resources.groovy

That's about all the configuration there is.

You can then send messages using the JmsService...

The mySqsLister() is always listening to SQS for new messages.

One comment on “Amazon Web Services SQS in Grails with Spring JMS”

  1. Thanks Bryan, this was a big help. Thought I'd mention that for me it was necesssary to add the jms api jar to my local maven cache after updating BuildConfig.groovy. This prevented a javax.jms.MessageListener class not found exception when building locally. In case anyone else runs into this, the jms.jar can be had from http://www.oracle.com/technetwork/java/javaee/downloads/index.html. I added it to the local repository using something the following.

    mvn install:install-file -Dfile=jms.jar -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar

Leave a Reply

linkedin-squaregithub-squarestack-overflowfacebook-official