Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

It's a Groovy library with a Groovy Categories GroovyJMS provides set of Groovy-style APIs, enhanced JMS API with Groovy Categories, and a powerful JMSPool bean, that make it very easy to use JMS in Groovy application. It transparently handle connection and session lifecycle, and adds some thread-safe convenient methods to the JMS APIs. e.g. send a message to a login queue with

Take a simple example:

Code Block
jms{
 "loginService".send [user:'groovy', password:'jms'].send("loginService")
 
 // or [user:'groovy', password:'jms'].sendTo "loginService"
}

And a complex one:

Code Block

// create a JMS Thread Pool with 10 threads at max
def pool = new JMSPool(maximumPoolSize:10)
// subscribe to three destinations, each with 2 threads
pool.onMessage([fromQueue:['queue0','queue1'],fromTopic:'topic0',threads:2]){ m -> println m}

This module is in its early stage. The provided example are fully functional, but some relatively complex scenario may require directly JMS API usage

...