Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

It's a Groovy Categories that make it very easy to use JMS in Groovy application.


  • You have to provide the JMS Factory, refer to the Spring ActiveMQ setup section on this page, or check the JMS setup examples in the Grails JMS Plugin page.


Let's start with some examples first:

Setup JMS Connection Factory

For every example, it's assumed a JMS Connection Factory called "jms" is existed. For example, you could create a ActiveMQ connection factory programmatically with:

Simple usages

  1. Subscribe to a Topic message
  2. Send a message to a Queue or Topic
  3. Receive a Queue message
    The receive parameter means "receives the next message that arrives within the specified timeout interval", check JMS JavaDoc for details:
  4. Reply to a message

By default, it reuses JMS Connection and Session. The connection and session are created when any of connect(), session(), topic() or queue() method is first called, and the connection and session are binded to a internal ThreadLocal variables until close() is called.

How it works?


  • It's current hardcoded to use Log4j. It could be changed or removed on request. 
  • No labels