If no method name is provided then one is attempted to be chosen using the rules for Bean Binding; using the type of the message body and using any annotations on the bean methods.
Using Bean Expressions from the Java DSL
Using Bean Expressions from XML
Writing the expression bean
The bean in the above examples is just any old Java Bean with a method called isGoldCustomer() that returns some object that is easily converted to a boolean value in this case, as its used as a predicate.
So we could implement it like this...
We can also use the Bean Integration annotations. For example you could do...
So you can bind parameters of the method to the Exchange, the Message or individual headers, properties, the body or other expressions.
Non registry beans
The Bean Language also supports invoking beans that isn't registered in the Registry. This is usable for quickly to invoke a bean from Java DSL where you don't need to register the bean in the Registry such as the Spring ApplicationContext.
Camel can instantiate the bean and invoke the method if given a class or invoke an already existing instance. This is illustrated from the example below:
The 2nd parameter
In Camel 2.2 onwards you can avoid the
Which also can be done in a bit shorter and nice way:
We have some test cases you can look at if it'll help
The Bean language is part of camel-core.