Versions Compared

Key

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

Groovy

Camel supports Groovy among other Scripting Languages to allow an Expression or Predicate to be used in the DSL or Xml Configuration.

To use a Groovy expression use the following Java code

Code Block
import static org.apache.camel.builder.script.ScriptBuilder.*;

...

... groovy("someGroovyExpression") ... 

For example you could use the groovy function to create an Predicate in a Message Filter or as an Expression for a Recipient List

Example

Code Block
// lets route if a line item is over $100
from("queue:foo").filter(groovy("request.lineItems.any { i -> i.value > 100 }")).to("queue:bar")