EL was originally specified as part of the JSP 2.1 standard (JSR-245), but it is now available as a standalone language. Apache Camel integrates with JUEL (http://juel.sourceforge.net/), which is an open source implementation of the EL language.
To use EL in your routes you need to add a dependency on
camel-juel to your project as shown in
Example 2, “Adding the camel-juel dependency”.
Example 2. Adding the camel-juel dependency
<!-- Maven POM File -->
<properties>
<camel-version>2.11.0-fuse-00-xx</camel-version>
...
</properties>
<dependencies>
...
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-juel</artifactId>
<version>${camel-version}</version>
</dependency>
...
</dependencies>Table 2, “EL variables” lists the variables that are accessible when using EL.
Table 2. EL variables
| Variable | Type | Value |
|---|---|---|
exchange | org.apache.camel.Exchange | The current Exchange |
in | org.apache.camel.Message | The IN message |
out | org.apache.camel.Message | The OUT message |
Example 3, “Routes using EL” shows two routes that use EL.
Example 3. Routes using EL
<camelContext>
<route>
<from uri="seda:foo"/>
<filter>
<language language="el">${in.headers.foo == 'bar'}</language>
<to uri="seda:bar"/>
</filter>
</route>
<route>
<from uri="seda:foo2"/>
<filter>
<language language="el">${in.headers['My Header'] == 'bar'}</language>
<to uri="seda:bar"/>
</filter>
</route>
</camelContext>