Mapping the message to method parameters
Camel provides a capability called Parameter Binding, which allows your route to explicitly map parts of the message to your method parameters when Camel invokes a Java method. This can be used anywhere you can use the Bean or Method Expression Languages, such as in a predicate, processor step, or expression.
This recipe will show you how to specify the mapping of the exchange values to your method parameters right within the DSL.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.extend.binding
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with binding
.
This recipe assumes the existence of a Java class with the following definition, though the techniques explained in this recipe can be applied to any Java method call:
public class MyBean { public String sayHello(String name, boolean hipster) { return (hipster) ? ("Yo " + name) : ("Hello " + name...