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

    • Rule Chain Overview
    • Rule Chain
    • Message
      • Differences between Metadata and Data
        • 1. Definition
        • 2. Usage
        • 3. Example
    • Rule Node
    • Relation Type
  • Standard Components

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

Message

Message is the input and output data or events of the rule chain. It can be transformed, filtered and distributed by the node components. It contains the following content:

  • Ts: Type: int64, the timestamp of the message generation
  • Id: Type: string, message ID, the same message in the rule engine circulation, the whole process is unique
  • DataType: Type: string, value: JSON, TEXT, BINARY, default value: JSON. If it is JSON type, it will be automatically converted to an object in the script component, and you can directly operate the json field.
  • Type: Type: string, message type. Rule node components can route by this field.
  • Data: Type: string, message content
  • Metadata: Type: map[string]string, message metadata.

# Differences between Metadata and Data

In the RuleGo rules engine, the metadata and data (also referred to as the message payload) of a message have the following differences:

# 1. Definition

  • metadata (Metadata): This is additional information related to the message, stored in key-value pairs. It typically does not contain the core content of the message but is used to describe the context, source, or other auxiliary information of the message. For example, metadata may include the device type of the message source, timestamp, user attributes, product ID, device type, etc.
  • data (Message Payload): This is the actual content of the message, usually in the form of a JSON-formatted message, containing the core data that needs to be processed. For example, measurements such as temperature and humidity from a sensor.

# 2. Usage

  • metadata:
    • Provides contextual information about the message to help the rules engine (or processing node) better understand and process it.
    • Can be used for message routing, filtering, and conditional judgments. For example, the processing path of the message can be determined based on the device type or user attributes in the metadata.
    • Can be dynamically updated and expanded within the rules chain.
  • data:
    • Contains the core data that needs to be processed or analyzed.
    • Is the primary object for data transformation, calculation, and storage in the rules engine (or processing node).

# 3. Example

Assume there is a message from a temperature sensor:

  • metadata:
    {
      "sensorType": "temperature",
      "deviceId": "sensor123",
      "timestamp": "2025-02-27T10:00:00Z"
    }
    
    1
    2
    3
    4
    5
  • data:
    {
      "temperature": 22.4
    }
    
    1
    2
    3

In this example, the metadata describes the source and context of the message, while the data contains the actual temperature value.

Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
Rule Chain
Rule Node

← Rule Chain Rule Node→

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

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