appendix A Simple, the expression language

 

Camel offers a powerful expression language, which was called Simple because back in the earlier days, it wasn’t very powerful. It’s evolved to become much more since then, but don’t worry: it’s still simple to use. The Simple language is provided out of the box in the camel-core JAR file, which means you don’t have to add any JARs on the classpath to use it.

A.1 Introducing Simple

In a nutshell, the Simple expression language evaluates an expression on the current instance of Exchange that’s under processing. The Simple language can be used for both expressions and predicates, which makes it perfect to use in your Camel routes.

For example, the Content-Based Router EIP can use the Simple language to define predicates in the when clauses, as shown here:

The equivalent XML DSL example is as follows:

A.2 Syntax

A.3 Built-in variables

A.4 Built-in functions

A.5 Built-in file variables

A.6 Built-in operators

A.6.1 Combining expressions

A.7 The OGNL feature

A.8 Using Simple from custom Java code

Summary