...
However for much more complex use cases you are generally recommended to choose a more expressive and powerful language such as:
- SpEL
- Mvel
- Groovy
- JavaScript
- EL
- OGNL
- Mvel
- Groovy
- one of the supported Scripting Languages
...
Variable | Type | Description | ||
---|---|---|---|---|
camelId | String | Camel 2.10: the CamelContext name | ||
camelContext.OGNL | Object | Camel 2.11: the CamelContext invoked using a Camel OGNL expression. | ||
exchangeId | String | Camel 2.3: the exchange id | ||
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. The converted body can be null. | ||
mandatoryBodyAs(type) | Type | Camel 2.5: Converts the body to the given type determined by its classname, and expects the body to be not null. | ||
out.body | Object | the output body | ||
header.foo | Object | refer to the input foo header | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="07dcdf0c9bda2872-a0a4106c-480e4539-b599a6fe-5490bddb42e8212fd1ea8b39"><ac:plain-text-body><![CDATA[ | header[foo] | Object | Camel 2.9.2: refer to the input foo header | ]]></ac:plain-text-body></ac:structured-macro> |
headers.foo | Object | refer to the input foo header | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f2b793ad30ef50da-ba3e1f22-4b6646f4-b85db9be-094e98edab8687c91dcbadba"><ac:plain-text-body><![CDATA[ | headers[foo] | Object | Camel 2.9.2: refer to the input foo header | ]]></ac:plain-text-body></ac:structured-macro> |
in.header.foo | Object | refer to the input foo header | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="81d7e33b876695fe-c741ffba-4d684d2d-ba89ad40-3925ad6f43e396a3b67921bd"><ac:plain-text-body><![CDATA[ | in.header[foo] | Object | Camel 2.9.2: refer to the input foo header | ]]></ac:plain-text-body></ac:structured-macro> |
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="e3b16a78d2564ad6-161522ee-4ecb4272-b1df8c61-de247e63c2aba68fd53c80ff"><ac:plain-text-body><![CDATA[ | in.headers[foo] | Object | Camel 2.9.2: refer to the input foo header | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="53da88b682bc5bfb-c396f4b9-47814241-a5a6a59f-100f414ace69d2735b1a27dc"><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="103941364585ac4b-c65116ef-47734b48-9cb9b5eb-d1f404b5238cc4baeb6292e4"><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="07d03f8f08046b9a-be12b2fe-4cc54e53-91e890be-e783f860675991e68f66c0d8"><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> |
header.foo.OGNL | Object | Camel 2.3: refer to the 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 | Camel 2.3: refer to the input foo header and invoke its value using a Camel OGNL expression. | ||
out.header.foo | Object | refer to the out header foo | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8e83f49a8a328ddc-24d4a6c7-4d9b42db-98098d7d-ca16cf1af4733a9dad3844dc"><ac:plain-text-body><![CDATA[ | out.header[foo] | Object | Camel 2.9.2: refer to the out header foo | ]]></ac:plain-text-body></ac:structured-macro> |
out.headers.foo | Object | refer to the out header foo | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2ef85161aac285c1-3e4aaceb-4b074e28-b3459554-968f309e98db548fa1d7e904"><ac:plain-text-body><![CDATA[ | out.headers[foo] | Object | Camel 2.9.2: refer to the out header foo | ]]></ac:plain-text-body></ac:structured-macro> |
headerAs(key,type) | Type | Camel 2.5: Converts the header to the given type determined by its classname | ||
headers | Map | Camel 2.9: refer to the input headers | ||
in.headers | Map | Camel 2.9: refer to the input headers | ||
property.foo | Object | refer to the foo property on the exchange | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="015d3e96286c8ce1-73948a91-41794621-973cb1e2-206c022802eae3fb64ca4e3d"><ac:plain-text-body><![CDATA[ | property[foo] | Object | Camel 2.9.2: refer to the foo property on the exchange | ]]></ac:plain-text-body></ac:structured-macro> |
property.foo.OGNL | Object | Camel 2.8: refer to the foo property on the exchange and invoke its value using a Camel OGNL expression. | ||
sys.foo | String | refer to the system property | ||
sysenv.foo | String | Camel 2.3: refer to the system environment | ||
exception | Object | Camel 2.4: Refer to the exception object on the exchange, is null if no exception set on exchange. Will fallback and grab caught exceptions ( | ||
exception.OGNL | Object | Camel 2.4: Refer to the exchange exception invoked using a Camel OGNL expression object | ||
exception.message | String | Refer to the exception.message on the exchange, is null if no exception set on exchange. Will fallback and grab caught exceptions ( | ||
exception.stacktrace | String | Camel 2.6. Refer to the exception.stracktrace on the exchange, is null if no exception set on exchange. Will fallback and grab caught exceptions ( | ||
date:command:pattern | String | Date formatting using the | ||
bean:bean expression | Object | Invoking a bean expression using the Bean language. Specifying a method name you must use dot as separator. 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 | ||
threadName | String | Camel 2.3: Returns the name of the current thread. Can be used for logging purpose. | ||
ref:xxx | Object | Camel 2.6: To lookup a bean from the Registry with the given id. |
...
Notice by changing the start/end token you change those in all the Camel applications which share the same camel-core on their classpath.
For example in an OSGi server this may affect many applications, where as a Web Application as a WAR file it only affects the Web Application.
Loading script from external resource
Available as of Camel 2.11
You can externalize the script and have Camel load it from a resource such as "classpath:"
, "file:"
, or "http:"
.
This is done using the following syntax: "resource:scheme:location"
, eg to refer to a file on the classpath you can do:
Code Block |
---|
.setHeader("myHeader").simple("resource:classpath:mysimple.txt") |
Dependencies
The Simple language is part of camel-core.