Browse Source

Init all actors for isolated rule engines

pull/10028/head
ViacheslavKlimov 3 years ago
parent
commit
bf0cc22223
  1. 3
      application/src/main/java/org/thingsboard/server/actors/app/AppActor.java
  2. 20
      application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java

3
application/src/main/java/org/thingsboard/server/actors/app/AppActor.java

@ -202,8 +202,7 @@ public class AppActor extends ContextAwareActor {
return Optional.ofNullable(ctx.getOrCreateChildActor(new TbEntityActorId(tenantId), return Optional.ofNullable(ctx.getOrCreateChildActor(new TbEntityActorId(tenantId),
() -> DefaultActorService.TENANT_DISPATCHER_NAME, () -> DefaultActorService.TENANT_DISPATCHER_NAME,
() -> new TenantActor.ActorCreator(systemContext, tenantId), () -> new TenantActor.ActorCreator(systemContext, tenantId),
() -> systemContext.getServiceInfoProvider().isService(ServiceType.TB_CORE) || () -> true));
systemContext.getPartitionService().isManagedByCurrentService(tenantId)));
} }
private void onToEdgeSessionMsg(EdgeSessionMsg msg) { private void onToEdgeSessionMsg(EdgeSessionMsg msg) {

20
application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java

@ -90,18 +90,16 @@ public class TenantActor extends RuleChainManagerActor {
isCore = systemContext.getServiceInfoProvider().isService(ServiceType.TB_CORE); isCore = systemContext.getServiceInfoProvider().isService(ServiceType.TB_CORE);
isRuleEngine = systemContext.getServiceInfoProvider().isService(ServiceType.TB_RULE_ENGINE); isRuleEngine = systemContext.getServiceInfoProvider().isService(ServiceType.TB_RULE_ENGINE);
if (isRuleEngine) { if (isRuleEngine) {
if (systemContext.getPartitionService().isManagedByCurrentService(tenantId)) { try {
try { if (getApiUsageState().isReExecEnabled()) {
if (getApiUsageState().isReExecEnabled()) { log.debug("[{}] Going to init rule chains", tenantId);
log.debug("[{}] Going to init rule chains", tenantId); initRuleChains();
initRuleChains(); } else {
} else { log.info("[{}] Skip init of the rule chains due to API limits", tenantId);
log.info("[{}] Skip init of the rule chains due to API limits", tenantId);
}
} catch (Exception e) {
log.info("Failed to check ApiUsage \"ReExecEnabled\"!!!", e);
cantFindTenant = true;
} }
} catch (Exception e) {
log.info("Failed to check ApiUsage \"ReExecEnabled\"!!!", e);
cantFindTenant = true;
} }
} }
log.debug("[{}] Tenant actor started.", tenantId); log.debug("[{}] Tenant actor started.", tenantId);

Loading…
Cancel
Save