...
So if you declare any of the given type above they will be provided by Camel. A note on the Exception
is that it will bind to the caught exception of the Exchange. So its often usable if you use a POJO to handle a given using using eg an onException
route.
What is most interresting interesting is that Camel will also try to bind the body of the Exchange to the first parameter of the method signature (albeit not of any of the types above). So if we for instance declare e parameter as: String body
then Camel will bind the IN body to this type. Camel will also automatic type convert to the given type declared.
...
- The value is either
true
orfalse
which denotes a boolean value - The value is a numeric value such as
123
or7
- The value is a String enclosed with either single or double quotes
- The value is
null
which denotes a {{null} value - It can be evaluated using the Simple language, which means you can use eg body, header.foo and other Simple tokens.
...
Tip |
---|
Its a good idea to use ${ } placeholders in the method option as shown in the example above. This makes it clear to the read, that this is a Simple token and the actual value is dynamic computed form the Exchange being routed. |
If you want to pass in a {{null} value, then you can explicit define this in the method option as shown below:
Code Block |
---|
.to("bean:orderService?method=doSomething(null, true)")
|
By specifying null
as a parameter value, it instructs Camel to force passing in a null
value.
Besides the message body, you can pass in the message headers as a java.util.Map
type, and declare it as follows:
...