I was curious if there was a way to invoke methods on the incoming messages for performing choice() or setHeader() functions. I looked around on the website but couldn't find anything. Currently I have to write custom processors to do these types of simple jobs.
e.g.
class Person {
public boolean isCool() {
return false;
}
}
from("direct:foo")
.choice()
.when(body().method("isCool")).to("direct:coolPeople")
.otherwise().to("direct:uncoolPeople");
from("direct:foo");
.setHeader("IsCool", body().method("isCool"));
The Simple language can do this, it has OGNL support
http://camel.apache.org/simple
when(simple("${body.isCool()}").xxx
See the OGNL section of the link above.