Search in sources :

Example 6 with ToRuleEngineMsg

use of org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg in project thingsboard by thingsboard.

the class DefaultTransportService method sendToRuleEngine.

private void sendToRuleEngine(TenantId tenantId, TbMsg tbMsg, TbQueueCallback callback) {
    TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, tbMsg.getQueueName(), tenantId, tbMsg.getOriginator());
    if (log.isTraceEnabled()) {
        log.trace("[{}][{}] Pushing to topic {} message {}", tenantId, tbMsg.getOriginator(), tpi.getFullTopicName(), tbMsg);
    }
    ToRuleEngineMsg msg = ToRuleEngineMsg.newBuilder().setTbMsg(TbMsg.toByteString(tbMsg)).setTenantIdMSB(tenantId.getId().getMostSignificantBits()).setTenantIdLSB(tenantId.getId().getLeastSignificantBits()).build();
    ruleEngineProducerStats.incrementTotal();
    StatsCallback wrappedCallback = new StatsCallback(callback, ruleEngineProducerStats);
    ruleEngineMsgProducer.send(tpi, new TbProtoQueueMsg<>(tbMsg.getId(), msg), wrappedCallback);
}
Also used : TopicPartitionInfo(org.thingsboard.server.common.msg.queue.TopicPartitionInfo) ToRuleEngineMsg(org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg)

Aggregations

ToRuleEngineMsg (org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg)6 QueueToRuleEngineMsg (org.thingsboard.server.common.msg.queue.QueueToRuleEngineMsg)4 TopicPartitionInfo (org.thingsboard.server.common.msg.queue.TopicPartitionInfo)3 UUID (java.util.UUID)2 TbProtoQueueMsg (org.thingsboard.server.queue.common.TbProtoQueueMsg)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 DeviceId (org.thingsboard.server.common.data.id.DeviceId)1 DeviceProfileId (org.thingsboard.server.common.data.id.DeviceProfileId)1 TenantId (org.thingsboard.server.common.data.id.TenantId)1 TbMsg (org.thingsboard.server.common.msg.TbMsg)1 RuleEngineException (org.thingsboard.server.common.msg.queue.RuleEngineException)1 RuleNodeInfo (org.thingsboard.server.common.msg.queue.RuleNodeInfo)1 TbMsgCallback (org.thingsboard.server.common.msg.queue.TbMsgCallback)1 TbQueueConsumer (org.thingsboard.server.queue.TbQueueConsumer)1 TbRuleEngineQueueConfiguration (org.thingsboard.server.queue.settings.TbRuleEngineQueueConfiguration)1