JMS integration for the grails-routing plugin

  • Tags : messaging, jms, routing
  • Latest : 1.2.0
  • Last Updated: 06 February 2012
  • Grails version : 2.0.0 > *
  • Authors : Matthias Hryniszak
1 vote
Dependency :
compile ":routing-jms:1.2.0"

Documentation

Summary

Provides JMS integration for the grails-routing plugin

Installation

grails install-plugin routing-jms

Description

Please note that all development (including the examples) have recently been migrated to GitHub. Please update your branches!

Grails-Routing-JMS 1.2.0 is the current stable version.

See GitHub for known issues.

Sources: https://github.com/padcom/grails-routing-jms

Continuous integration: http://dev.aplaline.com/hudson/job/grails-routing-jms/

1.2.0 breaking changes

Since 1.2.0 the actual broker configuration has been moved from RoutingJmsConfig.groovy to Config.groovy and the task to install custom configuration file has been removed

Since version 1.2.0 this plugin does not use ConfigurationHolder or any other static holders. Therefore it is safe to use it in an environment where on one Tomcat there is more than Grails application running

Synopsis

This plugin provides support for JMS via ActiveMQ for the routing subsystem based on Apache Camel.

Usage

To use this plugin just install it and it will setup all the required dependencies right out of the box.

By default a local instance of ActiveMQ is used for this purpose but changing it is really simple. Just change the URL in your Config.groovy file

grails.plugin.routing.jms.brokerURL = "vm://LocalBroker"

to

grails.plugin.routing.jms.brokerURL = "tcp://localhost:61616"

and you're connecting to an instance of ActiveMQ running separately on your local machine.

Here's a simple route that takes messages from an ActiveMQ queue and sends them to standard output:

from('activemq:input.queue').to('stream:out')

And here's how you send messages to this queue:

sendMessage("activemq:input.queue", "Message")

By default the component will create Queues from the uri. To create a Topic, add "topic" to the URI:

sendMessage("activemq:topic:example.topic", "Message")

Camel has rich support for JMS and ActiveMQ. To learn more about what options are available, check out the Camel documentation on the ActiveMQ and JMS Components.

Ready to use examples

Here you'll find a simplistic example with just one controller (HomeController) and just one action (the index action) that when invoked will send a message to an internal queue (seda:input) which will then be routed through ActiveMQ queue, slightly processed and forwarded to standard output (stream:out)