Commit e251bc575036753744daa321bd2ca6017665b0bd
1 parent
3d54384b
Improvement to deserialization and remove debug on dashboards
Showing
3 changed files
with
15 additions
and
5 deletions
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | }, |
18 | 18 | "type": "org.thingsboard.rule.engine.filter.TbJsFilterNode", |
19 | 19 | "name": "Is Thermostat?", |
20 | - "debugMode": true, | |
20 | + "debugMode": false, | |
21 | 21 | "configuration": { |
22 | 22 | "jsScript": "return msg.id.entityType === \"DEVICE\" && msg.type === \"thermostat\";" |
23 | 23 | } |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | }, |
114 | 114 | "type": "org.thingsboard.rule.engine.action.TbCreateRelationNode", |
115 | 115 | "name": "Relate to Asset", |
116 | - "debugMode": true, | |
116 | + "debugMode": false, | |
117 | 117 | "configuration": { |
118 | 118 | "direction": "FROM", |
119 | 119 | "relationType": "ToAlarmPropagationAsset", | ... | ... |
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | }, |
82 | 82 | "type": "org.thingsboard.rule.engine.filter.TbJsSwitchNode", |
83 | 83 | "name": "Check Alarms", |
84 | - "debugMode": true, | |
84 | + "debugMode": false, | |
85 | 85 | "configuration": { |
86 | 86 | "jsScript": "var relations = [];\nif(metadata[\"ss_alarmTemperature\"] === \"true\"){\n if(msg.temperature > metadata[\"ss_thresholdTemperature\"]){\n relations.push(\"NewTempAlarm\");\n } else {\n relations.push(\"ClearTempAlarm\");\n }\n}\nif(metadata[\"ss_alarmHumidity\"] === \"true\"){\n if(msg.humidity < metadata[\"ss_thresholdHumidity\"]){\n relations.push(\"NewHumidityAlarm\");\n } else {\n relations.push(\"ClearHumidityAlarm\");\n }\n}\n\nreturn relations;" |
87 | 87 | } |
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 | }, |
94 | 94 | "type": "org.thingsboard.rule.engine.metadata.TbGetAttributesNode", |
95 | 95 | "name": "Fetch Configuration", |
96 | - "debugMode": true, | |
96 | + "debugMode": false, | |
97 | 97 | "configuration": { |
98 | 98 | "clientAttributeNames": [], |
99 | 99 | "sharedAttributeNames": [], | ... | ... |
... | ... | @@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.RuleNodeId; |
27 | 27 | import org.thingsboard.server.common.msg.gen.MsgProtos; |
28 | 28 | import org.thingsboard.server.common.msg.queue.TbMsgCallback; |
29 | 29 | |
30 | +import java.io.IOException; | |
30 | 31 | import java.io.Serializable; |
31 | 32 | import java.util.UUID; |
32 | 33 | |
... | ... | @@ -47,7 +48,7 @@ public final class TbMsg implements Serializable { |
47 | 48 | private final RuleChainId ruleChainId; |
48 | 49 | private final RuleNodeId ruleNodeId; |
49 | 50 | //This field is not serialized because we use queues and there is no need to do it |
50 | - private final TbMsgCallback callback; | |
51 | + transient private final TbMsgCallback callback; | |
51 | 52 | |
52 | 53 | public static TbMsg newMsg(String type, EntityId originator, TbMsgMetaData metaData, String data) { |
53 | 54 | return new TbMsg(UUID.randomUUID(), type, originator, metaData.copy(), TbMsgDataType.JSON, data, null, null, TbMsgCallback.EMPTY); |
... | ... | @@ -156,4 +157,13 @@ public final class TbMsg implements Serializable { |
156 | 157 | public TbMsg copyWithRuleNodeId(RuleChainId ruleChainId, RuleNodeId ruleNodeId) { |
157 | 158 | return new TbMsg(this.id, this.type, this.originator, this.metaData, this.dataType, this.data, ruleChainId, ruleNodeId, callback); |
158 | 159 | } |
160 | + | |
161 | + public TbMsgCallback getCallback() { | |
162 | + //May be null in case of deserialization; | |
163 | + if (callback != null) { | |
164 | + return callback; | |
165 | + } else { | |
166 | + return TbMsgCallback.EMPTY; | |
167 | + } | |
168 | + } | |
159 | 169 | } | ... | ... |