improvements
This commit is contained in:
parent
5de58644e5
commit
80fc2d9b86
@ -228,7 +228,7 @@ public class TenantActor extends RuleChainManagerActor {
|
||||
log.warn("RECEIVED INVALID MESSAGE: {}", msg);
|
||||
}
|
||||
if (deletedDevices.contains(msg.getDeviceId())) {
|
||||
log.warn("RECEIVED MESSAGE FOR DELETED DEVICE: {}", msg);
|
||||
log.debug("RECEIVED MESSAGE FOR DELETED DEVICE: {}", msg);
|
||||
return;
|
||||
}
|
||||
TbActorRef deviceActor = getOrCreateDeviceActor(msg.getDeviceId());
|
||||
@ -250,7 +250,8 @@ public class TenantActor extends RuleChainManagerActor {
|
||||
log.info("[{}] Received API state update. Going to ENABLE Rule Engine execution.", tenantId);
|
||||
initRuleChains();
|
||||
}
|
||||
} else if (msg.getEntityId().getEntityType() == EntityType.EDGE) {
|
||||
}
|
||||
if (msg.getEntityId().getEntityType() == EntityType.EDGE) {
|
||||
EdgeId edgeId = new EdgeId(msg.getEntityId().getId());
|
||||
EdgeRpcService edgeRpcService = systemContext.getEdgeRpcService();
|
||||
if (msg.getEvent() == ComponentLifecycleEvent.DELETED) {
|
||||
@ -259,11 +260,13 @@ public class TenantActor extends RuleChainManagerActor {
|
||||
Edge edge = systemContext.getEdgeService().findEdgeById(tenantId, edgeId);
|
||||
edgeRpcService.updateEdge(tenantId, edge);
|
||||
}
|
||||
} else if (msg.getEntityId().getEntityType() == EntityType.DEVICE && ComponentLifecycleEvent.DELETED == msg.getEvent()) {
|
||||
}
|
||||
if (msg.getEntityId().getEntityType() == EntityType.DEVICE && ComponentLifecycleEvent.DELETED == msg.getEvent()) {
|
||||
DeviceId deviceId = (DeviceId) msg.getEntityId();
|
||||
onToDeviceActorMsg(new DeviceDeleteMsg(tenantId, deviceId), true);
|
||||
deletedDevices.add(deviceId);
|
||||
} else if (isRuleEngine) {
|
||||
}
|
||||
if (isRuleEngine) {
|
||||
TbActorRef target = getEntityActorRef(msg.getEntityId());
|
||||
if (target != null) {
|
||||
if (msg.getEntityId().getEntityType() == EntityType.RULE_CHAIN) {
|
||||
|
||||
@ -44,9 +44,9 @@ import org.thingsboard.server.common.msg.rpc.FromDeviceRpcResponseActorMsg;
|
||||
import org.thingsboard.server.common.msg.rpc.RemoveRpcActorMsg;
|
||||
import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequest;
|
||||
import org.thingsboard.server.common.msg.rpc.ToDeviceRpcRequestActorMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceDeleteMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceAttributesEventNotificationMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceCredentialsUpdateNotificationMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceDeleteMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceEdgeUpdateMsg;
|
||||
import org.thingsboard.server.common.msg.rule.engine.DeviceNameOrTypeUpdateMsg;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos;
|
||||
@ -378,8 +378,8 @@ public class ProtoUtils {
|
||||
);
|
||||
}
|
||||
|
||||
private static TransportProtos.DeviceDeletedMsgProto toProto(DeviceDeleteMsg msg) {
|
||||
return TransportProtos.DeviceDeletedMsgProto.newBuilder()
|
||||
private static TransportProtos.DeviceDeleteMsgProto toProto(DeviceDeleteMsg msg) {
|
||||
return TransportProtos.DeviceDeleteMsgProto.newBuilder()
|
||||
.setTenantIdMSB(msg.getTenantId().getId().getMostSignificantBits())
|
||||
.setTenantIdLSB(msg.getTenantId().getId().getLeastSignificantBits())
|
||||
.setDeviceIdMSB(msg.getDeviceId().getId().getMostSignificantBits())
|
||||
@ -387,7 +387,7 @@ public class ProtoUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static DeviceDeleteMsg fromProto(TransportProtos.DeviceDeletedMsgProto proto) {
|
||||
private static DeviceDeleteMsg fromProto(TransportProtos.DeviceDeleteMsgProto proto) {
|
||||
return new DeviceDeleteMsg(
|
||||
TenantId.fromUUID(new UUID(proto.getTenantIdMSB(), proto.getTenantIdLSB())),
|
||||
new DeviceId(new UUID(proto.getDeviceIdMSB(), proto.getDeviceIdLSB())));
|
||||
@ -424,8 +424,8 @@ public class ProtoUtils {
|
||||
return TransportProtos.ToDeviceActorNotificationMsgProto.newBuilder().setRemoveRpcActorMsg(proto).build();
|
||||
} else if (msg instanceof DeviceDeleteMsg) {
|
||||
DeviceDeleteMsg updateMsg = (DeviceDeleteMsg) msg;
|
||||
TransportProtos.DeviceDeletedMsgProto proto = toProto(updateMsg);
|
||||
return TransportProtos.ToDeviceActorNotificationMsgProto.newBuilder().setDeviceAssignToTenantMsgProto(proto).build();
|
||||
TransportProtos.DeviceDeleteMsgProto proto = toProto(updateMsg);
|
||||
return TransportProtos.ToDeviceActorNotificationMsgProto.newBuilder().setDeviceDeleteMsg(proto).build();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -445,8 +445,8 @@ public class ProtoUtils {
|
||||
return fromProto(proto.getFromDeviceRpcResponseMsg());
|
||||
} else if (proto.hasRemoveRpcActorMsg()) {
|
||||
return fromProto(proto.getRemoveRpcActorMsg());
|
||||
} else if (proto.hasDeviceAssignToTenantMsgProto()) {
|
||||
return fromProto(proto.getDeviceAssignToTenantMsgProto());
|
||||
} else if (proto.hasDeviceDeleteMsg()) {
|
||||
return fromProto(proto.getDeviceDeleteMsg());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1004,7 +1004,7 @@ message RemoveRpcActorMsgProto {
|
||||
int64 deviceIdLSB = 6;
|
||||
}
|
||||
|
||||
message DeviceDeletedMsgProto {
|
||||
message DeviceDeleteMsgProto {
|
||||
int64 tenantIdMSB = 1;
|
||||
int64 tenantIdLSB = 2;
|
||||
int64 deviceIdMSB = 3;
|
||||
@ -1019,7 +1019,7 @@ message ToDeviceActorNotificationMsgProto {
|
||||
ToDeviceRpcRequestActorMsgProto toDeviceRpcRequestMsg = 5;
|
||||
FromDeviceRpcResponseActorMsgProto fromDeviceRpcResponseMsg = 6;
|
||||
RemoveRpcActorMsgProto removeRpcActorMsg = 7;
|
||||
DeviceDeletedMsgProto deviceAssignToTenantMsgProto = 8;
|
||||
DeviceDeleteMsgProto deviceDeleteMsg = 8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user