规则引擎使用

# 使用

目前规则引擎的数据源,一种类型只支持一个实例,通过配置的source枚举类关联

# demo

过滤topic1的数据转发到kafka中


smqtt:
    rules: # 规则引擎相关配置
        - ruleName: test-rule
          chain: # 规则链
            - ruleType: PREDICATE  # 条件过滤器
              script: topic.equals("test/test")
            - ruleType: KAFKA  # KAFKA过滤器
              script:  '{"topic":"${topic}","msg":"${msg.test}","qos":${qos}}'
    sources: # 配置数据源sources
        - source: KAFKA # kafka配置
          sourceName: kafka
          sourceAttributes:
              topic: testTopic
              bootstrap-servers: 172.16.63.50:9092
              key-serializer: org.apache.kafka.common.serialization.StringSerializer
              value-serializer: org.apache.kafka.common.serialization.StringSerializer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Last Updated: 12/10/2021, 5:44:48 AM