|
This version is still in development and is not considered stable yet. |
Expressions
The pipelite-expression module provides a textual expression evaluation engine used by filter and by the when(…) of toRoute(…). It is a small, purpose-built expression language, not Java or SpEL - only the operators and functions listed below are available, no arbitrary method calls.
Syntax
Expressions are plain strings, evaluated at runtime with no wrapping delimiter - this is a
different mechanism from the #{…} text-interpolation syntax used inside dynamic destination
strings (see Queue Channel Adapter's own note on it). Two
variables are bound automatically before every evaluation:
| Variable | Resolves to |
|---|---|
|
The input payload of the |
|
The headers of the |
Operators
| Operator | Aliases |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arithmetic (addition/subtraction also work as unary |
Functions
| Function | Description |
|---|---|
|
Boolean negation |
|
|
|
Square root |
|
Rounds a number using the engine’s configured |
|
Reads a property off |
String literals use single quotes ('ORDER'), not double.
Usage in DSL
Implementation
Both filter and the when(…) of toRoute(…) evaluate their expression as a whole, with
Payload and Headers bound to the current Exchange, and it must evaluate to a boolean. This is a
different mechanism from the {…} text interpolation used inside dynamic strings such as a
routing target, e.g. "queue://{Headers['region']}-orders", which is evaluated inside the string
and can produce any text.
The expression engine is intentionally simple - no arbitrary method calls, no user-defined functions.
For anything beyond what the operators/functions above express, use a Processor with plain Java code instead.
|