RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

    • Standard Components Overview
    • filter

    • action

    • transform

      • jsTransform
      • exprTransform
      • metadataTransform
        • Configuration
        • Relation Type
        • Execution Result
        • Configuration Example
      • text/template
    • external

    • flow

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

metadataTransform

metadataTransform component: metadata transformer. It uses the expression language provided by the expr (opens new window) library to transform metadata or create new metadata.

# Configuration

Field Type Description Default Value
mapping map Transformation expressions, format (field: transformation expression) None
isNew bool Whether to create a new metadata list, true: create a new metadata list, false: update the corresponding metadata key false
  • 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 type variable.
  • Access the data type through the dataType variable.

Expression examples:

  • upper(msg.name)
  • metaData.productType
  • msg.temperature+50
  • replace(metaData.productType,'oldValue','newValue')

For more expr expression syntax, refer to: expr (opens new window)

# Relation Type

  • Success: If executed successfully, send the message to the Success chain.
  • Failure: If execution fails, send the message to the Failure chain.

# Execution Result

Replace the metadata content based on the expression execution result.

# Configuration Example

{
  "id": "s1",
  "type": "metadataTransform",
  "name": "Metadata Transformation",
  "configuration": {
    "mapping": {
      "name":        "upper(msg.name)",
      "tmp":         "msg.temperature",
      "alarm":       "msg.temperature>50",
      "productType": "metaData.productType"
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
exprTransform
text/template

← exprTransform text/template→

Theme by Vdoing | Copyright © 2023-2025 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式