...
The parameters to the SQL queries are named parameters in the elsql mapping files, and maps to corresponding keys from the Camel message, in the given precedence:
1. Camel 2.16.1: from message body if Simple expression.
2. from message body if its a
java.util.Map
...
3. from message headers
If a named parameter cannot be resolved, then an exception is thrown.
...
Code Block | ||
---|---|---|
| ||
from("direct:projects") .setHeader("lic", constant("ASF")) .setHeader("min", constant(123)) .to("elsql:projects:com/foo/orders.elsql") |
And the elsql mapping file
Code Block |
---|
@NAME(projects) SELECT * FROM projects WHERE license = :lic AND id > :min ORDER BY id |
...
Code Block | ||
---|---|---|
| ||
from("direct:projects") .to("elsql:projects:com/foo/orders.elsql") |
In from Camel 2.16.1 onwards you can use Simple expressions as well, which allows to use an OGNL like notation on the message body, where it assumes to have getLicense
and getMinimum
methods:
Code Block |
---|
@NAME(projects)
SELECT *
FROM projects
WHERE license = :${body.license} AND id > :${body.minimum}
ORDER BY id |
Include Page | ||||
---|---|---|---|---|
|