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,6 +16,7 @@ | ||
16 | package org.thingsboard.server.service.state; | 16 | package org.thingsboard.server.service.state; |
17 | 17 | ||
18 | import com.fasterxml.jackson.databind.ObjectMapper; | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
19 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
19 | import com.google.common.base.Function; | 20 | import com.google.common.base.Function; |
20 | import com.google.common.util.concurrent.FutureCallback; | 21 | import com.google.common.util.concurrent.FutureCallback; |
21 | import com.google.common.util.concurrent.Futures; | 22 | import com.google.common.util.concurrent.Futures; |
@@ -503,8 +504,15 @@ public class DefaultDeviceStateService implements DeviceStateService { | @@ -503,8 +504,15 @@ public class DefaultDeviceStateService implements DeviceStateService { | ||
503 | private void pushRuleEngineMessage(DeviceStateData stateData, String msgType) { | 504 | private void pushRuleEngineMessage(DeviceStateData stateData, String msgType) { |
504 | DeviceState state = stateData.getState(); | 505 | DeviceState state = stateData.getState(); |
505 | try { | 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 | clusterService.pushMsgToRuleEngine(stateData.getTenantId(), stateData.getDeviceId(), tbMsg, null); | 516 | clusterService.pushMsgToRuleEngine(stateData.getTenantId(), stateData.getDeviceId(), tbMsg, null); |
509 | } catch (Exception e) { | 517 | } catch (Exception e) { |
510 | log.warn("[{}] Failed to push inactivity alarm: {}", stateData.getDeviceId(), state, e); | 518 | log.warn("[{}] Failed to push inactivity alarm: {}", stateData.getDeviceId(), state, e); |