There are two parts. First, method(..) is a Camel expression type called a predicate. Any valid method that you call should return a boolean, therefore:
public class ExpensiveOrderFilter { public boolean isCheapOrder(Order order) { return order.getPrice() < 100.00; } }
The Order parameter will be injected into the best attempt by a Camel mechanism called bean binding , which will try to convert the message body to Order. If this fails, the route will throw an exception.
You name the method that should be called in the bean in the method(..) block:
.filter().method(eof, "isCheapOrder")
Only cheap orders will be continued. For simple expressions, you can also consider the simple expression language built into Camel and skip the bean entry:
.filter().simple("${body.price} < 100")
source share