Search in sources :

Example 1 with PageDataIterable

use of org.thingsboard.server.common.data.page.PageDataIterable in project thingsboard by thingsboard.

the class AppActor method preStart.

@Override
public void preStart() {
    logger.info("Starting main system actor.");
    try {
        ruleManager.init(this.context());
        pluginManager.init(this.context());
        if (systemContext.isTenantComponentsInitEnabled()) {
            PageDataIterable<Tenant> tenantIterator = new PageDataIterable<>(tenantService::findTenants, ENTITY_PACK_LIMIT);
            for (Tenant tenant : tenantIterator) {
                logger.debug("[{}] Creating tenant actor", tenant.getId());
                getOrCreateTenantActor(tenant.getId());
                logger.debug("Tenant actor created.");
            }
        }
        logger.info("Main system actor started.");
    } catch (Exception e) {
        logger.error(e, "Unknown failure");
    }
}
Also used : PageDataIterable(org.thingsboard.server.common.data.page.PageDataIterable) Tenant(org.thingsboard.server.common.data.Tenant)

Example 2 with PageDataIterable

use of org.thingsboard.server.common.data.page.PageDataIterable in project thingsboard by thingsboard.

the class RuleManager method doInit.

private void doInit(ActorContext context) {
    PageDataIterable<RuleMetaData> ruleIterator = new PageDataIterable<>(getFetchRulesFunction(), ContextAwareActor.ENTITY_PACK_LIMIT);
    ruleMap = new HashMap<>();
    for (RuleMetaData rule : ruleIterator) {
        log.debug("[{}] Creating rule actor {}", rule.getId(), rule);
        ActorRef ref = getOrCreateRuleActor(context, rule.getId());
        ruleMap.put(rule, RuleActorMetaData.systemRule(rule.getId(), rule.getWeight(), ref));
        log.debug("[{}] Rule actor created.", rule.getId());
    }
    refreshRuleChain();
}
Also used : PageDataIterable(org.thingsboard.server.common.data.page.PageDataIterable) ActorRef(akka.actor.ActorRef) RuleMetaData(org.thingsboard.server.common.data.rule.RuleMetaData)

Example 3 with PageDataIterable

use of org.thingsboard.server.common.data.page.PageDataIterable in project thingsboard by thingsboard.

the class PluginManager method init.

public void init(ActorContext context) {
    PageDataIterable<PluginMetaData> pluginIterator = new PageDataIterable<>(getFetchPluginsFunction(), ContextAwareActor.ENTITY_PACK_LIMIT);
    for (PluginMetaData plugin : pluginIterator) {
        log.debug("[{}] Creating plugin actor", plugin.getId());
        getOrCreatePluginActor(context, plugin.getId());
        log.debug("Plugin actor created.");
    }
}
Also used : PageDataIterable(org.thingsboard.server.common.data.page.PageDataIterable) PluginMetaData(org.thingsboard.server.common.data.plugin.PluginMetaData)

Aggregations

PageDataIterable (org.thingsboard.server.common.data.page.PageDataIterable)3 ActorRef (akka.actor.ActorRef)1 Tenant (org.thingsboard.server.common.data.Tenant)1 PluginMetaData (org.thingsboard.server.common.data.plugin.PluginMetaData)1 RuleMetaData (org.thingsboard.server.common.data.rule.RuleMetaData)1