1 Introduction
Version: 2.0.0.RC2
Table of Contents
1 Introduction
This plugin makes it easy to both send and receive JMS messages inside a Grails application.Examples
The following are some simple examples to give you a feel for the plugin.Service Queue Listeners
class ListeningService { static exposes = ['jms'] def onMessage(message) {
assert message == 1
}
}
class SomeController { def jmsService def someAction = { jmsService.send(service: 'listening', 1) } }
Service Method Queue Listeners
import grails.plugin.jms.Queueclass ListeningService { static exposes = ['jms'] @Queue def receive(message) { assert message == 1 } }
class SomeController { def jmsService def someAction = { jmsService.send(service: 'listening', method: 'receive', 1) } }
Topic Listeners
import grails.plugin.jms.Subscriberclass ListeningService { static exposes = ['jms'] @Subscriber def newMessages(message) { assert message == 1 } }
class SomeController { def jmsService def someAction = { jmsService.send(topic: 'newMessages', 1) } }
Post Processing Messages
import javax.jms.Messageclass SomeController { def jmsService def someAction = {
jmsService.send(service: 'initial', 1) { Message msg ->
msg.JMSReplyTo = createDestination(service: 'reply')
msg
}
}
}