THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
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:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... from('direct:test') .transform { it.in.body.reverse() } .process { println it.in.body } ... |
The corresponding route in Java would look something like this:
Code Block | ||
---|---|---|
| ||
... from('direct:test') .transform(new Expression() { @Override public Object evaluate(Exchange e) { return new StringBuffer(e.getIn().getBody().toString()).reverse().toString(); } }) .process(new Processor() { @Override public void process(Exchange e) { System.out.println(e.getIn().getBody()); } }); ... |
Developing with the Groovy DSL
...