renamed new msgs

This commit is contained in:
IrynaMatveieva 2025-04-11 09:49:58 +03:00
parent 2cfa9a0103
commit a6cdc170cb
8 changed files with 20 additions and 20 deletions

View File

@ -113,7 +113,7 @@ public class AppActor extends ContextAwareActor {
case SESSION_TIMEOUT_MSG: case SESSION_TIMEOUT_MSG:
ctx.broadcastToChildrenByType(msg, EntityType.TENANT); ctx.broadcastToChildrenByType(msg, EntityType.TENANT);
break; break;
case CF_ACTOR_INIT_MSG: case CF_CACHE_INIT_MSG:
case CF_PROFILE_ENTITY_MSG: case CF_PROFILE_ENTITY_MSG:
case CF_INIT_MSG: case CF_INIT_MSG:
case CF_LINK_INIT_MSG: case CF_LINK_INIT_MSG:

View File

@ -22,12 +22,12 @@ import org.thingsboard.server.actors.TbActorException;
import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.msg.TbActorStopReason; import org.thingsboard.server.common.msg.TbActorStopReason;
import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg;
import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg;
/** /**
* Created by ashvayka on 15.03.18. * Created by ashvayka on 15.03.18.
@ -67,11 +67,11 @@ public class CalculatedFieldManagerActor extends AbstractCalculatedFieldActor {
case CF_PARTITIONS_CHANGE_MSG: case CF_PARTITIONS_CHANGE_MSG:
processor.onPartitionChange((CalculatedFieldPartitionChangeMsg) msg); processor.onPartitionChange((CalculatedFieldPartitionChangeMsg) msg);
break; break;
case CF_ACTOR_INIT_MSG: case CF_CACHE_INIT_MSG:
processor.onActorInitMsg((CalculatedFieldActorInitMsg) msg); processor.onCacheInitMsg((CalculatedFieldCacheInitMsg) msg);
break; break;
case CF_PROFILE_ENTITY_MSG: case CF_PROFILE_ENTITY_MSG:
processor.onProfileEntityMsg((ProfileEntityMsg) msg); processor.onProfileEntityMsg((CalculatedFieldProfileEntityMsg) msg);
break; break;
case CF_INIT_MSG: case CF_INIT_MSG:
processor.onFieldInitMsg((CalculatedFieldInitMsg) msg); processor.onFieldInitMsg((CalculatedFieldInitMsg) msg);

View File

@ -35,12 +35,12 @@ import org.thingsboard.server.common.data.id.DeviceId;
import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.common.data.page.PageDataIterable;
import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg;
import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg;
import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg;
import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.ServiceType;
import org.thingsboard.server.common.msg.queue.TbCallback; import org.thingsboard.server.common.msg.queue.TbCallback;
@ -116,14 +116,14 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
ctx.stop(ctx.getSelf()); ctx.stop(ctx.getSelf());
} }
public void onActorInitMsg(CalculatedFieldActorInitMsg msg) { public void onCacheInitMsg(CalculatedFieldCacheInitMsg msg) {
log.debug("[{}] Processing CF actor init message.", msg.getTenantId().getId()); log.debug("[{}] Processing CF actor init message.", msg.getTenantId().getId());
initEntityProfileCache(); initEntityProfileCache();
initCalculatedFields(); initCalculatedFields();
msg.getCallback().onSuccess(); msg.getCallback().onSuccess();
} }
public void onProfileEntityMsg(ProfileEntityMsg msg) { public void onProfileEntityMsg(CalculatedFieldProfileEntityMsg msg) {
log.debug("[{}] Processing profile entity message.", msg.getTenantId().getId()); log.debug("[{}] Processing profile entity message.", msg.getTenantId().getId());
entityProfileCache.add(msg.getProfileEntityId(), msg.getEntityId()); entityProfileCache.add(msg.getProfileEntityId(), msg.getEntityId());
msg.getCallback().onSuccess(); msg.getCallback().onSuccess();

View File

@ -50,7 +50,7 @@ import org.thingsboard.server.common.msg.TbMsg;
import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg;
import org.thingsboard.server.common.msg.aware.DeviceAwareMsg; import org.thingsboard.server.common.msg.aware.DeviceAwareMsg;
import org.thingsboard.server.common.msg.aware.RuleChainAwareMsg; import org.thingsboard.server.common.msg.aware.RuleChainAwareMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg;
import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg;
import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg;
import org.thingsboard.server.common.msg.queue.PartitionChangeMsg; import org.thingsboard.server.common.msg.queue.PartitionChangeMsg;
@ -177,7 +177,7 @@ public class TenantActor extends RuleChainManagerActor {
case RULE_CHAIN_TO_RULE_CHAIN_MSG: case RULE_CHAIN_TO_RULE_CHAIN_MSG:
onRuleChainMsg((RuleChainAwareMsg) msg); onRuleChainMsg((RuleChainAwareMsg) msg);
break; break;
case CF_ACTOR_INIT_MSG: case CF_CACHE_INIT_MSG:
case CF_PROFILE_ENTITY_MSG: case CF_PROFILE_ENTITY_MSG:
case CF_INIT_MSG: case CF_INIT_MSG:
case CF_LINK_INIT_MSG: case CF_LINK_INIT_MSG:
@ -277,7 +277,7 @@ public class TenantActor extends RuleChainManagerActor {
() -> DefaultActorService.CF_MANAGER_DISPATCHER_NAME, () -> DefaultActorService.CF_MANAGER_DISPATCHER_NAME,
() -> new CalculatedFieldManagerActorCreator(systemContext, tenantId), () -> new CalculatedFieldManagerActorCreator(systemContext, tenantId),
() -> true); () -> true);
cfActor.tellWithHighPriority(new CalculatedFieldActorInitMsg(tenantId)); cfActor.tellWithHighPriority(new CalculatedFieldCacheInitMsg(tenantId));
} catch (Exception e) { } catch (Exception e) {
log.info("[{}] Failed to init CF Actor.", tenantId, e); log.info("[{}] Failed to init CF Actor.", tenantId, e);
} }

View File

@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.actors.ActorSystemContext;
import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.ProfileEntityIdInfo;
import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.common.data.page.PageDataIterable;
import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg;
import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.asset.AssetService;
import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.queue.util.AfterStartUp; import org.thingsboard.server.queue.util.AfterStartUp;
@ -49,7 +49,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer
for (ProfileEntityIdInfo idInfo : deviceIdInfos) { for (ProfileEntityIdInfo idInfo : deviceIdInfos) {
log.trace("Processing device record: {}", idInfo); log.trace("Processing device record: {}", idInfo);
try { try {
actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId()));
} catch (Exception e) { } catch (Exception e) {
log.error("Failed to process device record: {}", idInfo, e); log.error("Failed to process device record: {}", idInfo, e);
} }
@ -58,7 +58,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer
for (ProfileEntityIdInfo idInfo : assetIdInfos) { for (ProfileEntityIdInfo idInfo : assetIdInfos) {
log.trace("Processing asset record: {}", idInfo); log.trace("Processing asset record: {}", idInfo);
try { try {
actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId()));
} catch (Exception e) { } catch (Exception e) {
log.error("Failed to process asset record: {}", idInfo, e); log.error("Failed to process asset record: {}", idInfo, e);
} }

View File

@ -136,7 +136,7 @@ public enum MsgType {
EDGE_SYNC_RESPONSE_FROM_EDGE_SESSION_MSG, EDGE_SYNC_RESPONSE_FROM_EDGE_SESSION_MSG,
CF_ACTOR_INIT_MSG, // Sent to init caches for CF actor; CF_CACHE_INIT_MSG, // Sent to init caches for CF actor;
CF_PROFILE_ENTITY_MSG, // Sent to init profile entities cache; CF_PROFILE_ENTITY_MSG, // Sent to init profile entities cache;
CF_INIT_MSG, // Sent to init particular calculated field; CF_INIT_MSG, // Sent to init particular calculated field;
CF_LINK_INIT_MSG, // Sent to init particular calculated field; CF_LINK_INIT_MSG, // Sent to init particular calculated field;

View File

@ -21,13 +21,13 @@ import org.thingsboard.server.common.msg.MsgType;
import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg;
@Data @Data
public class CalculatedFieldActorInitMsg implements ToCalculatedFieldSystemMsg { public class CalculatedFieldCacheInitMsg implements ToCalculatedFieldSystemMsg {
private final TenantId tenantId; private final TenantId tenantId;
@Override @Override
public MsgType getMsgType() { public MsgType getMsgType() {
return MsgType.CF_ACTOR_INIT_MSG; return MsgType.CF_CACHE_INIT_MSG;
} }
} }

View File

@ -22,7 +22,7 @@ import org.thingsboard.server.common.msg.MsgType;
import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg;
@Data @Data
public class ProfileEntityMsg implements ToCalculatedFieldSystemMsg { public class CalculatedFieldProfileEntityMsg implements ToCalculatedFieldSystemMsg {
private final TenantId tenantId; private final TenantId tenantId;
private final EntityId profileEntityId; private final EntityId profileEntityId;