Camel - Bean: parameter binding
Single parameter binding
The bean component (BeanProcessor) uses the input message ❶ to bind its body to the first parameter of the method ❷, which happens to be the String name parameter. Camel does this by creating an expression that type-converts the input message body to the String type. This ensures that when Camel invokes the echo method ❸, the parameter matches the expected type.
Multiple parameter binding
Working with multiple parameters (best practices)
Using multiple parameters is more complex than using single parameters. It’s generally a good idea to follow these rules of thumb:
- Use the first parameter for the message body, which may or may not use the @Body annotation.
- Use either a built-in type or add Camel annotations for subsequent parameters.
- When having more than two parameters, consider specifying the binding in the method-name signature, which makes it clear for humans and Camel how each parameter should be mapped.