use of org.thingsboard.server.common.msg.queue.TopicPartitionInfo in project thingsboard by thingsboard.
the class DefaultTbContext method enqueueForTellFailure.
@Override
public void enqueueForTellFailure(TbMsg tbMsg, String failureMessage) {
TopicPartitionInfo tpi = resolvePartition(tbMsg);
enqueueForTellNext(tpi, tbMsg, Collections.singleton(TbRelationTypes.FAILURE), failureMessage, null, null);
}
use of org.thingsboard.server.common.msg.queue.TopicPartitionInfo in project thingsboard by thingsboard.
the class DefaultTbContext method enqueueForTellNext.
@Override
public void enqueueForTellNext(TbMsg tbMsg, String queueName, Set<String> relationTypes, Runnable onSuccess, Consumer<Throwable> onFailure) {
TopicPartitionInfo tpi = resolvePartition(tbMsg, queueName);
enqueueForTellNext(tpi, queueName, tbMsg, relationTypes, null, onSuccess, onFailure);
}
use of org.thingsboard.server.common.msg.queue.TopicPartitionInfo in project thingsboard by thingsboard.
the class DefaultTbContext method enqueueForTellNext.
@Override
public void enqueueForTellNext(TbMsg tbMsg, Set<String> relationTypes) {
TopicPartitionInfo tpi = resolvePartition(tbMsg);
enqueueForTellNext(tpi, tbMsg, relationTypes, null, null, null);
}
use of org.thingsboard.server.common.msg.queue.TopicPartitionInfo in project thingsboard by thingsboard.
the class DefaultTbClusterService method broadcast.
private void broadcast(ToTransportMsg transportMsg, TbQueueCallback callback) {
TbQueueProducer<TbProtoQueueMsg<ToTransportMsg>> toTransportNfProducer = producerProvider.getTransportNotificationsMsgProducer();
Set<String> tbTransportServices = partitionService.getAllServiceIds(ServiceType.TB_TRANSPORT);
TbQueueCallback proxyCallback = callback != null ? new MultipleTbQueueCallbackWrapper(tbTransportServices.size(), callback) : null;
for (String transportServiceId : tbTransportServices) {
TopicPartitionInfo tpi = partitionService.getNotificationsTopic(ServiceType.TB_TRANSPORT, transportServiceId);
toTransportNfProducer.send(tpi, new TbProtoQueueMsg<>(UUID.randomUUID(), transportMsg), proxyCallback);
toTransportNfs.incrementAndGet();
}
}
use of org.thingsboard.server.common.msg.queue.TopicPartitionInfo in project thingsboard by thingsboard.
the class DefaultTbClusterService method pushNotificationToRuleEngine.
@Override
public void pushNotificationToRuleEngine(String serviceId, FromDeviceRpcResponse response, TbQueueCallback callback) {
TopicPartitionInfo tpi = partitionService.getNotificationsTopic(ServiceType.TB_RULE_ENGINE, serviceId);
log.trace("PUSHING msg: {} to:{}", response, tpi);
FromDeviceRPCResponseProto.Builder builder = FromDeviceRPCResponseProto.newBuilder().setRequestIdMSB(response.getId().getMostSignificantBits()).setRequestIdLSB(response.getId().getLeastSignificantBits()).setError(response.getError().isPresent() ? response.getError().get().ordinal() : -1);
response.getResponse().ifPresent(builder::setResponse);
ToRuleEngineNotificationMsg msg = ToRuleEngineNotificationMsg.newBuilder().setFromDeviceRpcResponse(builder).build();
producerProvider.getRuleEngineNotificationsMsgProducer().send(tpi, new TbProtoQueueMsg<>(response.getId(), msg), callback);
toRuleEngineNfs.incrementAndGet();
}
Aggregations