Versions Compared

Key

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

...

Now we'll go through the various options which are available when working with JBI and Groovy in ServiceMix

Maintaining state across requests

Its often handy to keep track of state across requests. There is a variable called 'bindings' which you can use to maintain state...

Wiki Markup
{snippet:id=groovy|lang=xml|url=http://cvs.servicemix.codehaus.org/*checkout*/servicemix/base/src/test/resources/org/servicemix/components/cache/example.xml?rev=HEAD}

Working with JBI properties

In ServiceMix you can access the JBI message properties as a Map and work natively with it in Groovy using various mechanisms. e.g.

...

Code Block
outMessage.properties = [foo:"hello", someList:[1, 2, 3]]

Maintaining state across requests

Its often handy to keep track of state across requests. There is a variable called 'bindings' which you can use to maintain state...

Wiki Markup
{snippet:id=groovy|lang=xml|url=http://cvs.servicemix.codehaus.org/*checkout*/servicemix/base/src/test/resources/org/servicemix/components/cache/example.xml?rev=HEAD}

Generating output

Groovy provides various mechanism for generating the output (whether it is the result of a service or a transformation). Which mechnism you use depends on your use case and personal preference.

...