百度智能云

All Product Document

          Intelligent Edge

          baetyl-rule Module

          Introduction

          baetyl-rule can realize the message circulation on the baetyl framework end side to exchange the message at baetyl-broker (end message center), function service, and IoT Hub (cloud mqtt broker).

          It supports the following message circulation modes:

          • Subscribe to the message topics of baetyl-broker, send it to other message topics, and support the function handle.
          • Subscribe to the message topics of baetyl-broker, send it to the message topics of other message nodes (such as IoT Hub), and support the function handle.
          • Subscribe to the message topics of other message nodes, send it to the message topics of baetyl-broker, and support the function handle.

          baetyl supports the Python, Node, and SQL runtime, and you can configure related script functions to filter, process, transform and enrich the messages. Refer to the baetyl-function module for details.

          Configuration

          The full configuration files of baetyl-rule are shown as follows, and the configuration field is explained correspondingly:

          clients: # Message node. You can subscribe to messages from the node, you can also send the message node
            - name: iothub # name
              kind: mqtt # mqtt Type
              address: 'ssl://u7isgiz.mqtt.iot.bj.baidubce.com:1884' # address
              username: client.example.org # username
              ca: ../example/var/lib/baetyl/testcert/ca.pem # Connecting node's CA
              key: ../example/var/lib/baetyl/testcert/client.key #The private key of the connected node
              cert: ../example/var/lib/baetyl/testcert/client.pem # The public key of the connected node
              insecureSkipVerify: true # Whether to skip server certificate verification
          rules: # Message rule
            - name: rule1 # Rule name, which must be unique
              source: # News source
                topic: broker/topic1 # Message subject
                qos: 1 # Message quality
              target: # Message destination
                client: iothub # The essage node. If failed to set it, the default value is baetyl-broker
                topic: iothub/topic2 # Message subject
                qos: 0 # Message quality
            - name: rule2 # The rule name, which must be unique
              source: # News source
                topic: broker/topic5 # Message subject
                qos: 0 # Message quality
              target: # Message destination
                topic: broker/topic6 Message subject
                qos: 1 # Message quality
              function: # Processing function
                name: node85 # Function name

          baetyl-rule will automatically add the node information of baetyl-broker in the Node Information list. When the client field of a rule is not configured, it will be set to baetyl-broker by default, to subscribe the message from baetyl-broker or forward the message to baetyl-broker.

          Previous
          baetyl-function Module
          Next
          baetyl-broker Module