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)
  • StreamSQL
  • 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)
  • StreamSQL
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

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

  • Rule Chain

  • Standard Components

  • Extension Components

    • Extension Components Overview
    • filter

    • transform

    • external

      • redisClient
        • Configuration
        • Configuration Details
          • cmd Field
          • params Field
        • Relation Type
        • Execution result
        • Configuration Examples
          • Example 1: Using command only with params
          • Example 2: Using command with parameters format
          • Example 3: Complete command (without params)
        • Application example
      • kafkaProducer
      • natsClient
      • rabbitmqClient
      • opengeminiWrite
      • opengeminiQuery
      • MongoDB Client
      • Redis Publisher
      • grpcClient
      • OpenTelemetry
      • BeanstalkdWorker
      • BeanstalkdTube
      • WukongimSender
      • NSQ Client
      • Pulsar Client
    • ai

    • ci

    • IoT

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

redisClient

x/redisClient component: redis client. Can execute redis commands.

# Configuration

This component allows the reuse of shared connection clients through the server field. See Component Connection Reuse for reference.

Field Type Description Default value
server string Redis server address, format: host:port None
password string Redis password None
poolSize int Connection pool size 0
db int Redis database index 0
cmd string Redis command, supports command with parameters format (e.g., "SET key value") and ${} variable replacement None
paramsExpr Deprecated string Dynamic parameter expression (deprecated, use params field instead) None
params array Command parameters, supports ${} variable replacement and Component Configuration Variables None

# Configuration Details

# cmd Field

The cmd field supports two formats:

  1. Command only: Such as "SET", "GET", "HSET", etc., with parameters provided via the params field
  2. Command with parameters: Such as "SET key value", "HSET myhash field1 value1", etc., where command and parameters are provided together

# params Field

The params field supports:

  • Static parameters: Direct parameter values, such as ["key1", "value1"]
  • Dynamic parameters: Using ${} syntax for variable replacement, such as ["${metadata.key}", "${data}"]
  • Component configuration variables: Supports all Component Configuration Variables syntax

# Relation Type

  • Success: Execution successful, send the message to the Success chain
  • Failure: Execution failed, send the message to the Failure chain

# Execution result

The execution result replaces msg.Data and passes to the next node.

# Configuration Examples

# Example 1: Using command only with params

{
  "id": "s5",
  "type": "x/redisClient",
  "name": "Save to redis",
  "debugMode": true,
  "configuration": {
    "server": "192.168.1.1:6379",
    "cmd": "SET",
    "params": ["${metadata.key}", "${metadata.value}"],
    "poolSize": 10
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

# Example 2: Using command with parameters format

{
  "id": "s6",
  "type": "x/redisClient",
  "name": "Set hash field",
  "debugMode": true,
  "configuration": {
    "server": "192.168.1.1:6379",
    "cmd": "HSET ${msg.hashKey} ${msg.field}",
    "params": ["${data}"],
    "poolSize": 10
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

# Example 3: Complete command (without params)

{
  "id": "s7",
  "type": "x/redisClient",
  "name": "Complete SET command",
  "debugMode": true,
  "configuration": {
    "server": "192.168.1.1:6379",
    "cmd": "SET ${msg.key} ${msg.value}",
    "poolSize": 10
  }
}
1
2
3
4
5
6
7
8
9
10
11

# Application example

Application example reference: redisClient (opens new window)

{
  "ruleChain": {
    "id":"chain_msg_type_switch",
    "name": "Test rule chain-msgTypeSwitch",
    "root": false,
    "debugMode": false
  },
  "metadata": {
    "nodes": [
      {
        "id": "s1",
        "type": "msgTypeSwitch",
        "name": "Filter",
        "debugMode": true
      },
      {
        "id": "s2",
        "type": "log",
        "name": "Log 1",
        "debugMode": true,
        "configuration": {
          "jsScript": "return msgType+':s2--'+JSON.stringify(msg);"
        }
      },
      {
        "id": "s3",
        "type": "log",
        "name": "Log 2",
        "debugMode": true,
        "configuration": {
          "jsScript": "return msgType+':s3--'+JSON.stringify(msg);"
        }
      },
      {
        "id": "s5",
        "type": "x/redisClient",
        "name": "Save to redis",
        "debugMode": true,
        "configuration": {
          "cmd": "SET",
          "params": ["${msg.key1}", "${msg.value1}"],
          "poolSize": 10,
          "Server": "192.168.1.1:6379"
        }
      },
	{
        "id": "s6",
        "type": "x/redisClient",
        "name": "Save to redis",
        "debugMode": true,
        "configuration": {
          "cmd": "SET",
          "params": ["${msg.key2}", "${msg.value2}"],
          "poolSize": 10,
          "Server": "192.168.1.1:6379"
        }
      }
    ],
    "connections": [
      {
        "fromId": "s1",
        "toId": "s2",
        "type": "TEST_MSG_TYPE1"
      },
      {
        "fromId": "s1",
        "toId": "s3",
        "type": "TEST_MSG_TYPE2"
      },
      {
        "fromId": "s3",
        "toId": "s5",
        "type": "Success"
      },
  		{
        "fromId": "s2",
        "toId": "s6",
        "type": "Success"
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Edit this page on GitHub (opens new window)
Last Updated: 2025/08/31, 14:15:28
luaTransform
kafkaProducer

← luaTransform kafkaProducer→

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

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