Commit abd67d2536b82a9bc4d149e48048fc5299ec1908
Merge branch 'develop/2.5.3' of github.com:thingsboard/thingsboard into develop/2.5.3
Showing
1 changed file
with
10 additions
and
2 deletions
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | package org.thingsboard.server.service.state; |
17 | 17 | |
18 | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
19 | +import com.fasterxml.jackson.databind.node.ObjectNode; | |
19 | 20 | import com.google.common.base.Function; |
20 | 21 | import com.google.common.util.concurrent.FutureCallback; |
21 | 22 | import com.google.common.util.concurrent.Futures; |
... | ... | @@ -503,8 +504,15 @@ public class DefaultDeviceStateService implements DeviceStateService { |
503 | 504 | private void pushRuleEngineMessage(DeviceStateData stateData, String msgType) { |
504 | 505 | DeviceState state = stateData.getState(); |
505 | 506 | try { |
506 | - TbMsg tbMsg = TbMsg.newMsg(msgType, stateData.getDeviceId(), stateData.getMetaData().copy(), TbMsgDataType.JSON | |
507 | - , json.writeValueAsString(state)); | |
507 | + String data; | |
508 | + if (msgType.equals(CONNECT_EVENT)) { | |
509 | + ObjectNode stateNode = json.convertValue(state, ObjectNode.class); | |
510 | + stateNode.remove(ACTIVITY_STATE); | |
511 | + data = stateNode.toString(); | |
512 | + } else { | |
513 | + data = json.writeValueAsString(state); | |
514 | + } | |
515 | + TbMsg tbMsg = TbMsg.newMsg(msgType, stateData.getDeviceId(), stateData.getMetaData().copy(), TbMsgDataType.JSON, data); | |
508 | 516 | clusterService.pushMsgToRuleEngine(stateData.getTenantId(), stateData.getDeviceId(), tbMsg, null); |
509 | 517 | } catch (Exception e) { |
510 | 518 | log.warn("[{}] Failed to push inactivity alarm: {}", stateData.getDeviceId(), state, e); | ... | ... |