Thingsboard源码分析-规则引擎表设计 - 图1

rule_node(规则节点表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
rule_chain_id uuid 规则引擎编号
additional_info varchar 额外信息
configuration varchar(10000000) 配置
type varchar(255) 类型
name varchar(255) 名称
debug_mode boolean debug模式
search_text varchar(255) 搜素关键字

数据

id created_time rule_chain_id additional_info configuration type name debug_mode search_text
e1466350-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:825,”layoutY”:468} {“timeoutInSeconds”:60} org.thingsboard.rule.engine.rpc.TbSendRPCRequestNode RPC Call Request false rpc call request
e143f250-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:825,”layoutY”:379} {“jsScript”:”return ‘\nIncoming message:\n’ + JSON.stringify(msg) + ‘\nIncoming metadata:\n’ + JSON.stringify(metadata);”} org.thingsboard.rule.engine.action.TbLogNode Log Other false log other
e141a860-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:825,”layoutY”:266} {“jsScript”:”return ‘\nIncoming message:\n’ + JSON.stringify(msg) + ‘\nIncoming metadata:\n’ + JSON.stringify(metadata);”} org.thingsboard.rule.engine.action.TbLogNode Log RPC from Device false log rpc from device
e13f5e70-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:347,”layoutY”:149} {“version”:0} org.thingsboard.rule.engine.filter.TbMsgTypeSwitchNode Message Type Switch false message type switch
e13db0c0-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:825,”layoutY”:52} {“scope”:”CLIENT_SCOPE”} org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode Save Client Attributes false save client attributes
e136fa00-fcb8-11ea-82f8-9b35f0369853 0 e126f470-fcb8-11ea-82f8-9b35f0369853 {“layoutX”:824,”layoutY”:156} {“defaultTTL”:0} org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode Save Timeseries false save timeseries
e9193a00-008f-11eb-b578-a96e41c6df33 1601190365600 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:824,”layoutY”:156} {“defaultTTL”:0} org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode Save Timeseries false save timeseries
e91d31a0-008f-11eb-b578-a96e41c6df33 1601190365626 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:825,”layoutY”:52} {“scope”:”CLIENT_SCOPE”} org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode Save Client Attributes false save client attributes
e91f7b90-008f-11eb-b578-a96e41c6df33 1601190365641 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:347,”layoutY”:149} {“version”:0} org.thingsboard.rule.engine.filter.TbMsgTypeSwitchNode Message Type Switch false message type switch
e9219e70-008f-11eb-b578-a96e41c6df33 1601190365655 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:825,”layoutY”:266} {“jsScript”:”return ‘\nIncoming message:\n’ + JSON.stringify(msg) + ‘\nIncoming metadata:\n’ + JSON.stringify(metadata);”} org.thingsboard.rule.engine.action.TbLogNode Log RPC from Device false log rpc from device
e9240f70-008f-11eb-b578-a96e41c6df33 1601190365671 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:825,”layoutY”:379} {“jsScript”:”return ‘\nIncoming message:\n’ + JSON.stringify(msg) + ‘\nIncoming metadata:\n’ + JSON.stringify(metadata);”} org.thingsboard.rule.engine.action.TbLogNode Log Other false log other
e9268070-008f-11eb-b578-a96e41c6df33 1601190365687 e9123520-008f-11eb-b578-a96e41c6df33 {“layoutX”:825,”layoutY”:468} {“timeoutInSeconds”:60} org.thingsboard.rule.engine.rpc.TbSendRPCRequestNode RPC Call Request false rpc call request

DDL

  1. CREATE TABLE IF NOT EXISTS rule_node (
  2. id uuid NOT NULL CONSTRAINT rule_node_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. rule_chain_id uuid,
  5. additional_info varchar,
  6. configuration varchar(10000000),
  7. type varchar(255),
  8. name varchar(255),
  9. debug_mode boolean,
  10. search_text varchar(255)
  11. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图2

rule_chain(规则链表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
additional_info varchar 额外信息
configuration varchar(10000000) 配置
name varchar(255) 名称
first_rule_node_id uuid 第一规则节点编号
root boolean 根节点
debug_mode boolean debug模式
search_text varchar(255) 搜素关键字
tenant_id uuid 租户编号

数据

id created_time additional_info configuration name first_rule_node_id root debug_mode search_text tenant_id
e126f470-fcb8-11ea-82f8-9b35f0369853 1600768156983 {“description”:””} null Root Rule Chain e13f5e70-fcb8-11ea-82f8-9b35f0369853 true true root rule chain e102f1b0-fcb8-11ea-82f8-9b35f0369853
e9123520-008f-11eb-b578-a96e41c6df33 1601190365554 null null Root Rule Chain e91f7b90-008f-11eb-b578-a96e41c6df33 true false root rule chain e8fdc2c0-008f-11eb-b578-a96e41c6df33

DDL

  1. CREATE TABLE IF NOT EXISTS rule_chain (
  2. id uuid NOT NULL CONSTRAINT rule_chain_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. additional_info varchar,
  5. configuration varchar(10000000),
  6. name varchar(255),
  7. first_rule_node_id uuid,
  8. root boolean,
  9. debug_mode boolean,
  10. search_text varchar(255),
  11. tenant_id uuid
  12. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图3

relation(关联关系表)

属性

字段 类型 描述
from_id uuid 隶属于实体编号
from_type varchar(255) 隶属于实体类型
to_id uuid 管理于实体编号
to_type varchar(255) 管理于实体编号
relation_type_group varchar(255) 关联类型组
relation_type varchar(255) 关联关系类型
additional_info varchar 额外信息

数据

from_id from_type to_id to_type relation_type_group relation_type additional_info
e102f1b0-fcb8-11ea-82f8-9b35f0369853 TENANT e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e136fa00-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e13db0c0-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e141a860-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e143f250-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e126f470-fcb8-11ea-82f8-9b35f0369853 RULE_CHAIN e1466350-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_CHAIN Contains
e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE e143f250-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_NODE Other
e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE e13db0c0-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_NODE Post attributes
e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE e136fa00-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_NODE Post telemetry
e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE e141a860-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_NODE RPC Request from Device
e13f5e70-fcb8-11ea-82f8-9b35f0369853 RULE_NODE e1466350-fcb8-11ea-82f8-9b35f0369853 RULE_NODE RULE_NODE RPC Request to Device
e8fdc2c0-008f-11eb-b578-a96e41c6df33 TENANT e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e9193a00-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e91d31a0-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e9219e70-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e9240f70-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN e9268070-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_CHAIN Contains
e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE e9240f70-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_NODE Other
e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE e91d31a0-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_NODE Post attributes
e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE e9193a00-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_NODE Post telemetry
e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE e9219e70-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_NODE RPC Request from Device
e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE e9268070-008f-11eb-b578-a96e41c6df33 RULE_NODE RULE_NODE RPC Request to Device

DDL

  1. CREATE TABLE IF NOT EXISTS relation (
  2. from_id uuid,
  3. from_type varchar(255),
  4. to_id uuid,
  5. to_type varchar(255),
  6. relation_type_group varchar(255),
  7. relation_type varchar(255),
  8. additional_info varchar,
  9. CONSTRAINT relation_pkey PRIMARY KEY (from_id, from_type, relation_type_group, relation_type, to_id, to_type)
  10. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图4

alarm(警报表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
ack_ts bigint 回复时间
clear_ts bigint 清楚时间
additional_info varchar 额外信息
end_ts bigint 结束时间
originator_id uuid 起源编号
originator_type integer 起源类型
propagate boolean 传播
severity varchar(255) 安全级别
start_ts bigint 开始时间
status varchar(255) 状态
tenant_id uuid 租户编号
propagate_relation_types varchar 传播关系类型
type varchar(255) 类型

DDL

  1. CREATE TABLE IF NOT EXISTS alarm (
  2. id uuid NOT NULL CONSTRAINT alarm_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. ack_ts bigint,
  5. clear_ts bigint,
  6. additional_info varchar,
  7. end_ts bigint,
  8. originator_id uuid,
  9. originator_type integer,
  10. propagate boolean,
  11. severity varchar(255),
  12. start_ts bigint,
  13. status varchar(255),
  14. tenant_id uuid,
  15. propagate_relation_types varchar,
  16. type varchar(255)
  17. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图5

event(事件表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
body varchar(10000000) 数据
entity_id uuid 实体编号
entity_type varchar(255) 实体类型
event_type varchar(255) 事件类型
event_uid varchar(255) 事件编号
tenant_id uuid 租户编号
ts bigint 时间戳

数据

id created_time body entity_id entity_type event_type event_uid tenant_id ts
9f1bec30-0090-11eb-939c-8f37d197cde5 1601190670963 {“server”:”mushuweideMacBook-Pro.local”,”event”:”STARTED”,”success”:true} e91f7b90-008f-11eb-b578-a96e41c6df33 RULE_NODE LC_EVENT 9f1bec30-0090-11eb-939c-8f37d197cde5 e8fdc2c0-008f-11eb-b578-a96e41c6df33 1601190670963
9f1b01d0-0090-11eb-939c-8f37d197cde5 1601190670957 {“server”:”mushuweideMacBook-Pro.local”,”event”:”STARTED”,”success”:true} e91d31a0-008f-11eb-b578-a96e41c6df33 RULE_NODE LC_EVENT 9f1b01d0-0090-11eb-939c-8f37d197cde5 e8fdc2c0-008f-11eb-b578-a96e41c6df33 1601190670957
9f1cd690-0090-11eb-939c-8f37d197cde5 1601190670969 {“server”:”mushuweideMacBook-Pro.local”,”event”:”STARTED”,”success”:true} e9193a00-008f-11eb-b578-a96e41c6df33 RULE_NODE LC_EVENT 9f1cd690-0090-11eb-939c-8f37d197cde5 e8fdc2c0-008f-11eb-b578-a96e41c6df33 1601190670969
9f264c70-0090-11eb-939c-8f37d197cde5 1601190671031 {“server”:”mushuweideMacBook-Pro.local”,”event”:”STARTED”,”success”:true} e9268070-008f-11eb-b578-a96e41c6df33 RULE_NODE LC_EVENT 9f264c70-0090-11eb-939c-8f37d197cde5 e8fdc2c0-008f-11eb-b578-a96e41c6df33 1601190671031
9f289660-0090-11eb-939c-8f37d197cde5 1601190671046 {“server”:”mushuweideMacBook-Pro.local”,”event”:”STARTED”,”success”:true} e9123520-008f-11eb-b578-a96e41c6df33 RULE_CHAIN LC_EVENT 9f289660-0090-11eb-939c-8f37d197cde5 e8fdc2c0-008f-11eb-b578-a96e41c6df33 1601190671046

DDL

  1. CREATE TABLE IF NOT EXISTS event (
  2. id uuid NOT NULL CONSTRAINT event_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. body varchar(10000000),
  5. entity_id uuid,
  6. entity_type varchar(255),
  7. event_type varchar(255),
  8. event_uid varchar(255),
  9. tenant_id uuid,
  10. ts bigint NOT NULL,
  11. CONSTRAINT event_unq_key UNIQUE (tenant_id, entity_type, entity_id, event_type, event_uid)
  12. );Copy to clipboardErrorCopied

audit_log(审计日志表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
tenant_id uuid 租户编号
customer_id uuid 客户编号
entity_id uuid 实体编号
entity_type varchar(255) 实体类型
entity_name varchar(255) 实体名称
user_id uuid 用户编号
user_name varchar(255) 用户名称
action_type varchar(255) 动作类型
action_data varchar(1000000) 动作数据
action_status varchar(255) 动作状态
action_failure_details varchar(1000000) 动作失败细节

数据

id created_time tenant_id customer_id entity_id entity_type entity_name user_id user_name action_type action_data action_status action_failure_details
5e93abb0-e882-11ea-9e84-e3fc3b09427b 1598545721835 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 d96bfe60-e881-11ea-a452-0bb049e7ba49 USER sysadmin@thingsboard.org d96bfe60-e881-11ea-a452-0bb049e7ba49 sysadmin@thingsboard.org LOGIN {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 84.0.4147”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS
f32d52f0-fcb7-11ea-82f8-9b35f0369853 1600767757727 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 5a797660-4612-11e7-a919-92ebcb67fe33 USER 5a797660-4612-11e7-a919-92ebcb67fe33 sysadmin@thingsboard.org LOGOUT {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 85.0.4183”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS
fc2158c0-fcb7-11ea-82f8-9b35f0369853 1600767772748 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 d96bfe60-e881-11ea-a452-0bb049e7ba49 USER sysadmin@thingsboard.org d96bfe60-e881-11ea-a452-0bb049e7ba49 sysadmin@thingsboard.org LOGIN {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 85.0.4183”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS
c013aea0-fd39-11ea-bd9b-65a3fbb30788 1600823506570 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 bfd211c0-fd39-11ea-bd9b-65a3fbb30788 USER lovewsic@gmail.com d96bfe60-e881-11ea-a452-0bb049e7ba49 sysadmin@thingsboard.org ADDED {“entity”:{“id”:{“entityType”:”USER”,”id”:”bfd211c0-fd39-11ea-bd9b-65a3fbb30788”},”createdTime”:1600823506140,”additionalInfo”:{“description”:”admin manager”,”defaultDashboardId”:null,”defaultDashboardFullscreen”:false},”tenantId”:{“entityType”:”TENANT”,”id”:”e102f1b0-fcb8-11ea-82f8-9b35f0369853”},”customerId”:{“entityType”:”CUSTOMER”,”id”:”13814000-1dd2-11b2-8080-808080808080”},”email”:”lovewsic@gmail.com“,”authority”:”TENANT_ADMIN”,”firstName”:”书伟”,”lastName”:”穆”,”name”:”lovewsic@gmail.com“}} SUCCESS
e51c45e0-fd39-11ea-bd9b-65a3fbb30788 1600823568702 e102f1b0-fcb8-11ea-82f8-9b35f0369853 13814000-1dd2-11b2-8080-808080808080 bfd211c0-fd39-11ea-bd9b-65a3fbb30788 USER lovewsic@gmail.com bfd211c0-fd39-11ea-bd9b-65a3fbb30788 lovewsic@gmail.com LOGOUT {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 85.0.4183”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS
e9ff5750-fd39-11ea-bd9b-65a3fbb30788 1600823576901 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 d96bfe60-e881-11ea-a452-0bb049e7ba49 USER sysadmin@thingsboard.org d96bfe60-e881-11ea-a452-0bb049e7ba49 sysadmin@thingsboard.org LOGIN {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 85.0.4183”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS
1c279cb0-fd3a-11ea-bd9b-65a3fbb30788 1600823661051 13814000-1dd2-11b2-8080-808080808080 13814000-1dd2-11b2-8080-808080808080 d96bfe60-e881-11ea-a452-0bb049e7ba49 USER sysadmin@thingsboard.org d96bfe60-e881-11ea-a452-0bb049e7ba49 sysadmin@thingsboard.org LOGOUT {“clientAddress”:”0:0:0:0:0:0:0:1”,”browser”:”Chrome 85.0.4183”,”os”:”Mac OS X 10.15.6”,”device”:”Other”} SUCCESS

DDL

  1. CREATE TABLE IF NOT EXISTS audit_log (
  2. id uuid NOT NULL CONSTRAINT audit_log_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. tenant_id uuid,
  5. customer_id uuid,
  6. entity_id uuid,
  7. entity_type varchar(255),
  8. entity_name varchar(255),
  9. user_id uuid,
  10. user_name varchar(255),
  11. action_type varchar(255),
  12. action_data varchar(1000000),
  13. action_status varchar(255),
  14. action_failure_details varchar(1000000)
  15. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图6

component_descriptor(组件描述表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
actions varchar(255) 动作
clazz varchar 映射类
configuration_descriptor varchar 组件描述
name varchar(255) 名称
scope varchar(255) 应用范围
search_text varchar(255) 搜素关键字
type varchar(255) 类型

数据

id created_time actions clazz configuration_descriptor name scope search_text type
d8da1ea0-e881-11ea-a452-0bb049e7ba49 1598545497482 org.thingsboard.rule.engine.mail.TbMsgToEmailNode {“nodeDefinition”:{“details”:”Transforms message to email message by populating email fields using values derived from message metadata. Set ‘SEND_EMAIL’ output message type.”,”description”:”Transforms message to email message”,”inEnabled”:true,”outEnabled”:true,”relationTypes”:[“Success”,”Failure”],”customRelations”:false,”defaultConfiguration”:{“fromTemplate”:”info@testmail.org“,”toTemplate”:”${userEmail}”,”ccTemplate”:null,”bccTemplate”:null,”subjectTemplate”:”Device ${deviceType} temperature high”,”bodyTemplate”:”Device ${deviceName} has high temperature ${temp}”},”uiResources”:[“static/rulenode/rulenode-core-config.js”],”configDirective”:”tbTransformationNodeToEmailConfig”,”icon”:”email”,”iconUrl”:””,”docUrl”:””}} to email TENANT to email TRANSFORMATION
d90acb90-e881-11ea-a452-0bb049e7ba49 1598545497801 org.thingsboard.rule.engine.kafka.TbKafkaNode {“nodeDefinition”:{“details”:”Will send record via Kafka producer to Kafka server. Outbound message will contain response fields (offset, partition, topic) from the Kafka in the Message Metadata. For example partition field can be accessed with metadata.partition.”,”description”:”Publish messages to Kafka server”,”inEnabled”:true,”outEnabled”:true,”relationTypes”:[“Success”,”Failure”],”customRelations”:false,”defaultConfiguration”:{“topicPattern”:”my-topic”,”bootstrapServers”:”localhost:9092”,”retries”:0,”batchSize”:16384,”linger”:0,”bufferMemory”:33554432,”acks”:”-1”,”keySerializer”:”org.apache.kafka.common.serialization.StringSerializer”,”valueSerializer”:”org.apache.kafka.common.serialization.StringSerializer”,”otherProperties”:{},”addMetadataKeyValuesAsKafkaHeaders”:false,”kafkaHeadersCharset”:”UTF-8”},”uiResources”:[“static/rulenode/rulenode-core-config.js”],”configDirective”:”tbActionNodeKafkaConfig”,”icon”:””,”iconUrl”:”data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUzOCIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDQxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTIwMS44MTYgMjMwLjIxNmMtMTYuMTg2IDAtMzAuNjk3IDcuMTcxLTQwLjYzNCAxOC40NjFsLTI1LjQ2My0xOC4wMjZjMi43MDMtNy40NDIgNC4yNTUtMTUuNDMzIDQuMjU1LTIzLjc5NyAwLTguMjE5LTEuNDk4LTE2LjA3Ni00LjExMi0yMy40MDhsMjUuNDA2LTE3LjgzNWM5LjkzNiAxMS4yMzMgMjQuNDA5IDE4LjM2NSA0MC41NDggMTguMzY1IDI5Ljg3NSAwIDU0LjE4NC0yNC4zMDUgNTQuMTg0LTU0LjE4NCAwLTI5Ljg3OS0yNC4zMDktNTQuMTg0LTU0LjE4NC01NC4xODQtMjkuODc1IDAtNTQuMTg0IDI0LjMwNS01NC4xODQgNTQuMTg0IDAgNS4zNDguODA4IDEwLjUwNSAyLjI1OCAxNS4zODlsLTI1LjQyMyAxNy44NDRjLTEwLjYyLTEzLjE3NS0yNS45MTEtMjIuMzc0LTQzLjMzMy0yNS4xODJ2LTMwLjY0YzI0LjU0NC01LjE1NSA0My4wMzctMjYuOTYyIDQzLjAzNy01My4wMTlDMTI0LjE3MSAyNC4zMDUgOTkuODYyIDAgNjkuOTg3IDAgNDAuMTEyIDAgMTUuODAzIDI0LjMwNSAxNS44MDMgNTQuMTg0YzAgMjUuNzA4IDE4LjAxNCA0Ny4yNDYgNDIuMDY3IDUyLjc2OXYzMS4wMzhDMjUuMDQ0IDE0My43NTMgMCAxNzIuNDAxIDAgMjA2Ljg1NGMwIDM0LjYyMSAyNS4yOTIgNjMuMzc0IDU4LjM1NSA2OC45NHYzMi43NzRjLTI0LjI5OSA1LjM0MS00Mi41NTIgMjcuMDExLTQyLjU1MiA1Mi44OTQgMCAyOS44NzkgMjQuMzA5IDU0LjE4NCA1NC4xODQgNTQuMTg0IDI5Ljg3NSAwIDU0LjE4NC0yNC4zMDUgNTQuMTg0LTU0LjE4NCAwLTI1Ljg4My0xOC4yNTMtNDcuNTUzLTQyLjU1Mi01Mi44OTR2LTMyLjc3NWE2OS45NjUgNjkuOTY1IDAgMCAwIDQyLjYtMjQuNzc2bDI1LjYzMyAxOC4xNDNjLTEuNDIzIDQuODQtMi4yMiA5Ljk0Ni0yLjIyIDE1LjI0IDAgMjkuODc5IDI0LjMwOSA1NC4xODQgNTQuMTg0IDU0LjE4NCAyOS44NzUgMCA1NC4xODQtMjQuMzA1IDU0LjE4NC01NC4xODQgMC0yOS44NzktMjQuMzA5LTU0LjE4NC01NC4xODQtNTQuMTg0em0wLTEyNi42OTVjMTQuNDg3IDAgMjYuMjcgMTEuNzg4IDI2LjI3IDI2LjI3MXMtMTEuNzgzIDI2LjI3LTI2LjI3IDI2LjI3LTI2LjI3LTExLjc4Ny0yNi4yNy0yNi4yN2MwLTE0LjQ4MyAxMS43ODMtMjYuMjcxIDI2LjI3LTI2LjI3MXptLTE1OC4xLTQ5LjMzN2MwLTE0LjQ4MyAxMS43ODQtMjYuMjcgMjYuMjcxLTI2LjI3czI2LjI3IDExLjc4NyAyNi4yNyAyNi4yN2MwIDE0LjQ4My0xMS43ODMgMjYuMjctMjYuMjcgMjYuMjdzLTI2LjI3MS0xMS43ODctMjYuMjcxLTI2LjI3em01Mi41NDEgMzA3LjI3OGMwIDE0LjQ4My0xMS43ODMgMjYuMjctMjYuMjcgMjYuMjdzLTI2LjI3MS0xMS43ODctMjYuMjcxLTI2LjI3YzAtMTQuNDgzIDExLjc4NC0yNi4yNyAyNi4yNzEtMjYuMjdzMjYuMjcgMTEuNzg3IDI2LjI3IDI2LjI3em0tMjYuMjcyLTExNy45N2MtMjAuMjA1IDAtMzYuNjQyLTE2LjQzNC0zNi42NDItMzYuNjM4IDAtMjAuMjA1IDE2LjQzNy0zNi42NDIgMzYuNjQyLTM2LjY0MiAyMC4yMDQgMCAzNi42NDEgMTYuNDM3IDM2LjY0MSAzNi42NDIgMCAyMC4yMDQtMTYuNDM3IDM2LjYzOC0zNi42NDEgMzYuNjM4em0xMzEuODMxIDY3LjE3OWMtMTQuNDg3IDAtMjYuMjctMTEuNzg4LTI2LjI3LTI2LjI3MXMxMS43ODMtMjYuMjcgMjYuMjctMjYuMjcgMjYuMjcgMTEuNzg3IDI2LjI3IDI2LjI3YzAgMTQuNDgzLTExLjc4MyAyNi4yNzEtMjYuMjcgMjYuMjcxeiIvPjwvc3ZnPg==”,”docUrl”:””}} kafka TENANT kafka EXTERNAL

DDL

  1. CREATE TABLE IF NOT EXISTS component_descriptor (
  2. id uuid NOT NULL CONSTRAINT component_descriptor_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. actions varchar(255),
  5. clazz varchar UNIQUE,
  6. configuration_descriptor varchar,
  7. name varchar(255),
  8. scope varchar(255),
  9. search_text varchar(255),
  10. type varchar(255)
  11. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图7

dashboard(大屏展示表)

属性

字段 类型 描述
id uuid 设备编号
created_time bigint 创建时间
configuration varchar(10000000) 配置
assigned_customers varchar(1000000) 绑定的用户编号
title varchar(255) 标题
tenant_id uuid 租户编号
search_text varchar(255) 搜素关键字

数据

id created_time configuration assigned_customers search_text tenant_id title
352e77b0-0efb-11eb-bd9b-312d69df5943 1602775765675 {“description”:”测试大屏演示”,”widgets”:{“a39eadc7-212d-296f-35d7-1027f324c943”:{“isSystemType”:true,”bundleAlias”:”charts”,”typeAlias”:”basic_timeseries”,”type”:”timeseries”,”title”:”New widget”,”sizeX”:8,”sizeY”:5,”config”:{“datasources”:[{“type”:”entity”,”name”:null,”entityAliasId”:”8f1118f4-50b1-85ac-ed2d-49528df99361”,”filterId”:null,”dataKeys”:[{“name”:”key1”,”type”:”timeseries”,”label”:”key1”,”color”:”#2196f3”,”settings”:{“excludeFromStacking”:false,”hideDataByDefault”:false,”disableDataHiding”:false,”removeFromLegend”:false,”showLines”:true,”fillLines”:false,”showPoints”:false,”showPointShape”:”circle”,”pointShapeFormatter”:”var size = radius Math.sqrt(Math.PI) / 2;\nctx.moveTo(x - size, y - size);\nctx.lineTo(x + size, y + size);\nctx.moveTo(x - size, y + size);\nctx.lineTo(x + size, y - size);”,”showPointsLineWidth”:5,”showPointsRadius”:3,”tooltipValueFormatter”:””,”showSeparateAxis”:false,”axisTitle”:””,”axisPosition”:”left”,”axisTicksFormatter”:””,”thresholds”:[{“thresholdValueSource”:”predefinedValue”}],”comparisonSettings”:{“showValuesForComparison”:true,”comparisonValuesLabel”:””,”color”:””}},”_hash”:0.12011337287442503},{“name”:”key2”,”type”:”timeseries”,”label”:”key2”,”color”:”#4caf50”,”settings”:{“excludeFromStacking”:false,”hideDataByDefault”:false,”disableDataHiding”:false,”removeFromLegend”:false,”showLines”:true,”fillLines”:false,”showPoints”:false,”showPointShape”:”circle”,”pointShapeFormatter”:”var size = radius Math.sqrt(Math.PI) / 2;\nctx.moveTo(x - size, y - size);\nctx.lineTo(x + size, y + size);\nctx.moveTo(x - size, y + size);\nctx.lineTo(x + size, y - size);”,”showPointsLineWidth”:5,”showPointsRadius”:3,”tooltipValueFormatter”:””,”showSeparateAxis”:false,”axisTitle”:””,”axisPosition”:”left”,”axisTicksFormatter”:””,”thresholds”:[{“thresholdValueSource”:”predefinedValue”}],”comparisonSettings”:{“showValuesForComparison”:true,”comparisonValuesLabel”:””,”color”:””}},”_hash”:0.8800700216428552}]}],”timewindow”:{“realtime”:{“timewindowMs”:60000}},”showTitle”:true,”backgroundColor”:”#fff”,”color”:”rgba(0, 0, 0, 0.87)”,”padding”:”8px”,”settings”:{“shadowSize”:4,”fontColor”:”#545454”,”fontSize”:10,”xaxis”:{“showLabels”:true,”color”:”#545454”},”yaxis”:{“showLabels”:true,”color”:”#545454”},”grid”:{“color”:”#545454”,”tickColor”:”#DDDDDD”,”verticalLines”:true,”horizontalLines”:true,”outlineWidth”:1},”stack”:false,”tooltipIndividual”:false,”timeForComparison”:”months”,”xaxisSecond”:{“axisPosition”:”top”,”showLabels”:true}},”title”:”New Timeseries - Flot”,”dropShadow”:true,”enableFullscreen”:true,”titleStyle”:{“fontSize”:”16px”,”fontWeight”:400},”useDashboardTimewindow”:true},”row”:0,”col”:0,”id”:”a39eadc7-212d-296f-35d7-1027f324c943”},”455a0bea-da04-c914-1808-ae15847789b3”:{“isSystemType”:true,”bundleAlias”:”charts”,”typeAlias”:”pie_chart_js”,”type”:”latest”,”title”:”New widget”,”sizeX”:8,”sizeY”:5,”config”:{“datasources”:[{“type”:”entity”,”name”:null,”entityAliasId”:”8f1118f4-50b1-85ac-ed2d-49528df99361”,”filterId”:”68491524-7541-b55d-5da2-d6e7d4143c0e”,”dataKeys”:[{“name”:”attribute1”,”type”:”attribute”,”label”:”attribute1”,”color”:”#2196f3”,”settings”:{},”_hash”:0.9065485000787188}]}],”timewindow”:{“realtime”:{“timewindowMs”:60000}},”showTitle”:true,”backgroundColor”:”#fff”,”color”:”rgba(0, 0, 0, 0.87)”,”padding”:”8px”,”settings”:{},”title”:”New Pie - Chart.js”},”row”:0,”col”:0,”id”:”455a0bea-da04-c914-1808-ae15847789b3”}},”states”:{“default”:{“name”:”测试大屏”,”root”:true,”layouts”:{“main”:{“widgets”:{“a39eadc7-212d-296f-35d7-1027f324c943”:{“sizeX”:8,”sizeY”:5,”row”:0,”col”:0},”455a0bea-da04-c914-1808-ae15847789b3”:{“sizeX”:8,”sizeY”:5,”row”:5,”col”:0}},”gridSettings”:{“backgroundColor”:”#eeeeee”,”color”:”rgba(0,0,0,0.870588)”,”columns”:24,”margin”:10,”backgroundSizeMode”:”100%”}}}}},”entityAliases”:{“8f1118f4-50b1-85ac-ed2d-49528df99361”:{“id”:”8f1118f4-50b1-85ac-ed2d-49528df99361”,”alias”:”dashboard1”,”filter”:{“type”:”singleEntity”,”resolveMultiple”:false,”singleEntity”:{“entityType”:”DEVICE”,”id”:”95a6b470-09d0-11eb-b4d3-bd0dad4ce224”}}}},”filters”:{“68491524-7541-b55d-5da2-d6e7d4143c0e”:{“id”:”68491524-7541-b55d-5da2-d6e7d4143c0e”,”filter”:”filter1”,”keyFilters”:[{“key”:{“type”:”ATTRIBUTE”,”key”:”test1”},”valueType”:”STRING”,”predicates”:[{“keyFilterPredicate”:{“type”:”STRING”,”operation”:”STARTS_WITH”,”value”:{“defaultValue”:””},”ignoreCase”:false},”userInfo”:{“editable”:true,”label”:””,”autogeneratedLabel”:true,”order”:0}}]}],”editable”:true}},”timewindow”:{“displayValue”:””,”hideInterval”:false,”hideAggregation”:false,”hideAggInterval”:false,”selectedTab”:0,”realtime”:{“interval”:1000,”timewindowMs”:60000},”history”:{“historyType”:0,”interval”:1000,”timewindowMs”:60000,”fixedTimewindow”:{“startTimeMs”:1602689398541,”endTimeMs”:1602775798541}},”aggregation”:{“type”:”AVG”,”limit”:25000}},”settings”:{“stateControllerId”:”entity”,”showTitle”:false,”showDashboardsSelect”:true,”showEntitiesSelect”:true,”showDashboardTimewindow”:true,”showDashboardExport”:true,”toolbarAlwaysOpen”:true}} 测试大屏 e8fdc2c0-008f-11eb-b578-a96e41c6df33 测试大屏

DDL

  1. CREATE TABLE IF NOT EXISTS dashboard (
  2. id uuid NOT NULL CONSTRAINT dashboard_pkey PRIMARY KEY,
  3. created_time bigint NOT NULL,
  4. configuration varchar(10000000),
  5. assigned_customers varchar(1000000),
  6. search_text varchar(255),
  7. tenant_id uuid,
  8. title varchar(255)
  9. );Copy to clipboardErrorCopied

页面展示

Thingsboard源码分析-规则引擎表设计 - 图8