Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Variable

Type

Description

id

String

the input message id

body

Object

the input body

in.body

Object

the input body

body.OGNL

Object

Camel 2.3: the input body invoked using a Camel OGNL expression.

in.body.OGNL

Object

Camel 2.3: the input body invoked using a Camel OGNL expression.

bodyAs(type)

Type

Camel 2.3: Converts the body to the given type determined by its classname

out.body

Object

the output body

header.foo

Object

refer to the input foo header

headers.foo

Object

refer to the input foo header

in.header.foo

Object

refer to the input foo header

in.headers.foo

Object

refer to the input foo header

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="61dce2efebd85761-f023fb4e-4b8f4f64-9adeb037-b11994a0536913f1ffc248d2"><ac:plain-text-body><![CDATA[

header.foo[bar]

Object

Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e26ed9e9e29d1e42-187c1d2d-4eff49d7-90479062-bd194c3442666da2ed2b23b0"><ac:plain-text-body><![CDATA[

in.header.foo[bar]

Object

Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="12dd932bac3acf07-edeea277-4389437b-b5b3bb96-cdc42d3744e3a35f918fe965"><ac:plain-text-body><![CDATA[

in.headers.foo[bar]

Object

Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key

]]></ac:plain-text-body></ac:structured-macro>

out. header.foo.OGNL

Object

Camel 2.3: refer to the out header foo

out.headers.foo

Object

refer to the out header foo

property.foo

Object

refer to the foo property on the exchange

sys.foo

String

refer to the system property

input foo header and invoke its value using a Camel OGNL expression.

in.header.foo.OGNL

Object

Camel 2.3: refer to the input foo header and invoke its value using a Camel OGNL expression.

in.headers.foo.OGNL

Object

sysenv.foo

String

Camel 2.3: refer to the system environment

exception.message

String

Camel 2.0. Refer to the exception.message on the exchange, is null if no exception set on exchange. Will fallback and grab caught exceptions (Exchange.EXCEPTION_CAUGHT) if the Exchange has any.

date:command:pattern

String

Camel 1.5. Date formatting using the java.text.SimpleDataFormat patterns. Supported commands are: now for current timestamp, in.header.xxx or header.xxx to use the Date object in the IN header with the key xxx. out.header.xxx to use the Date object in the OUT header with the key xxx.

bean:bean expression

Object

Camel 1.5. Invoking a bean expression using the Bean language. Specifying a method name you must use dot as separator. In Camel 2.0 we also support the ?method=methodname syntax that is used by the Bean component.

input foo header and invoke its value using a Camel OGNL expression.

out.header.foo

Object

refer to the out header foo

out.headers.foo

Object

refer to the out header foo

property.foo

Object

refer to the foo property on the exchange

sys.foo

String

refer to the system property

sysenv.foo

String

Camel 2.3: refer to the system environment

exception.message

String

Camel 2.0. Refer to the exception.message on the exchange, is null if no exception set on exchange. Will fallback and grab caught exceptions (Exchange.EXCEPTION_CAUGHT) if the Exchange has any.

date:command:pattern

String

Camel 1.5. Date formatting using the java.text.SimpleDataFormat patterns. Supported commands are: now for current timestamp, in.header.xxx or header.xxx to use the Date object in the IN header with the key xxx. out.header.xxx to use the Date object in the OUT header with the key xxx.

bean:bean expression

Object

Camel 1.5. Invoking a bean expression using the Bean language. Specifying a method name you must use dot as separator. In Camel 2.0 we also support the ?method=methodname syntax that is used by the Bean component.

properties:locations:key

String

Camel 2.3: Lookup a property with the given key. The locations

properties:locations:key

String

Camel 2.3: Lookup a property with the given key. The locations option is optional. See more at Using PropertyPlaceholder.

OGNL support

Available as of Camel 2.3

The Simple and Bean language now supports a Camel OGNL notation for invoking beans in a chain like fashion.
Suppose the Message IN body contains a POJO which has a getAddress() method.

Then you can use Camel OGNL notation to access the address object:

Code Block

simple("${body.address}")
simple("${body.address.street}")
simple("${body.address.zip}")

Camel understands the shorthand names for getters, but you can invoke any method or use the real name such as:

Code Block

simple("${body.address}")
simple("${body.getAddress.getStreet}")
simple("${body.address.getZip}")
simple("${body.doSomething}")

You can also use the elvis operator (?.) to avoid NPE if for example the body does NOT have an address

Code Block

simple("${body?.address?.street}")

Its also possible to index in Map or List types, so you can do:

Code Block

simple("${body[foo].name}")

To assume the body is Map based and lookup the value with foo as key, and invoke the getName method on that value.

Suppose there was no value with the key foo then you can use the elvis operator to avoid the NPE as shown:

Code Block

simple("${body[foo]?.name}")

You can also access List types, for example to get lines from the address you can do:

Code Block

simple("${body.address.lines[0]}")
simple("${body.address.lines[1]}")
simple("${body.address.lines[2]}")

And yes you can combine this with the operator support as shown below:

Code Block

simple("${body.address.zip} > 1000")

Operator support

Available as of Camel 2.0
We added a basic set of operators supported in the simple language in Camel 2.0. The parser is limited to only support a single operator.

...