Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update Groovy documentation links to point to groovy-lang.org

...

The Groovy DSL implementation is built on top of the existing Java-based DSL, but it additionally allows to use Groovy language features in your routes, particularly Closures acting as Processor, Expression, Predicate, or Aggregation Strategy.
With the Groovy DSL you write your RouteBuilder classes entirely in Groovy, while the scripting component allows to embed small scripts into Java routes. The Groovy DSL requires Groovy 2.0 or newer and is available as of Camel 2.11.

...

The majority of the extension methods allow Closures to be used as parameters e.g. for expressions, predicates, processors. The following example reverses a string in the message body and then prints the value to System.out:

...

Using Groovy XML processing

Groovy provides special XML processing support through its XmlParser, XmlNodePrinter and XmlSlurper classes. camel-groovy provides two data formats to use these classes directly in your routes.

...

Using Groovy GStrings

Groovy GStrings are declared inside double-quotes and can contain arbitrary Groovy expressions like accessing properties or calling methods, e.g.

...

You can easily define your custom extensions - be it as a Java DSL extension for your Groovy routes or for any other class unrelated to Camel. All you have to do is to write your extension methods and provide a extension module descriptor - the details are described in the Groovy documentation. And as long as you don't require other extension methods, you can even use plain Java code to achieve this!
As an example, let's write two DSL extensions to make commonly used DSL methods more concise:

...