exprFilter
  exprFilter component: Expression filter. Use the expression language provided by the expr (opens new window) library to filter messages.
# Configuration
| Field | Type | Description | Default | 
|---|---|---|---|
| expr | string | Expression, the return value of the expression must be bool type | None | 
- Access the message ID through the 
${id}variable. - Access the message timestamp through the 
${ts}variable. - Access the original content of the message through the 
${data}variable. - Access the message body through the 
${msg}variable. If the message's dataType is JSON, you can access the fields of${msg}by${msg.XX}. For example:${msg.temperature} > 50; - Access the message metadata through the 
${metadata}variable. For example${metadata.customerName} - Access the message type through the 
${msgType}variable. - Access the data type through the 
${dataType}variable. 
Expression Examples:
- ${msg.temperature} > 50
 - ${msg.temperature} > 50 && ${metadata.customerName} == 'rulego'
 - upper(${metadata.customerName}[:4]) == 'GO'
For more expr expression syntax, refer to: expr (opens new window)
 
# Relation Type
- True: Send the message to the 
Truechain - False: Send the message to the 
Falsechain - Failure: Execution failed, send the message to the 
Failurechain 
# Execution Result
This component does not change the msg, metadata, and msgType content.
# Configuration Example
  {
    "id": "s1",
    "type": "exprFilter",
    "name": "Expression filter",
    "configuration": {
      "expr": "${msg.temperature} > 50"
    }
  }
 1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# Related Documentation
Edit this page on GitHub  (opens new window)
  Last Updated: 2025/09/03, 10:09:04