Expression Languages
An expression language is a way to define conditions or manipulate messages declaratively. They are used to evaluate and manipulate data within a message, allowing for the creation of more complex and flexible routes.
Here are the expression languages supported by Sensedia Integrations:
The examples show the use of the languages in the Choice component, but they can be used in any context that supports languages. |
-
Constant: returns a constant value.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: constant: expression: 'sensedia' steps: - log: message: 'When activated'
-
ExchangeProperty: accesses Exchange properties.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: exchangeProperty: expression: 'myproperty' steps: - log: message: 'When activated'
-
Groovy: uses Groovy scripts to manipulate messages.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: groovy: expression: 'Math.random() > 0.5' steps: - log: message: 'When activated'
-
Header: accesses values from message headers.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: header: expression: 'myheader' steps: - log: message: 'When activated'
-
JQ: uses the JQ language to query and manipulate JSON.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: jq: expression: '.store.book.price < 30' steps: - log: message: 'When activated'
-
JSONPath: similar to XPath, but for JSON.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: jsonpath: expression: $.model.Details[?(@['Random nonsense'] == 'New today')] steps: - log: message: 'When activated'
-
OGNL: uses Object-Graph Navigation Language expressions to access data.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: ognl: expression: 'request.headers.foo == "bar"' steps: - log: message: 'When activated'
-
Simple: a simple language for expressions and manipulations.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: simple: expression: ${header.id} == 2 steps: - log: message: 'When activated'
-
XPath: used to query and manipulate XML.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: xpath: expression: '/person/@id > 30' steps: - log: message: 'When activated'
-
XQuery: uses XQuery to query and manipulate XML.
- from: uri: rest:post:/demo parameters: {} steps: - choice: otherwise: steps: - log: message: 'Otherwise activated' when: - expression: xquery: expression: '//foo/id > 30' steps: - log: message: 'When activated'
For more details, access Apache Camel official documentation. |
Share your suggestions with us!
Click here and then [+ Submit idea]