|
|
|
@ -43,6 +43,7 @@ import org.thingsboard.server.queue.settings.TbQueueCoreSettings; |
|
|
|
import org.thingsboard.server.queue.settings.TbQueueRemoteJsInvokeSettings; |
|
|
|
import org.thingsboard.server.queue.settings.TbQueueRuleEngineSettings; |
|
|
|
import org.thingsboard.server.queue.settings.TbQueueTransportApiSettings; |
|
|
|
import org.thingsboard.server.queue.settings.TbQueueTransportNotificationSettings; |
|
|
|
import org.thingsboard.server.queue.sqs.TbAwsSqsAdmin; |
|
|
|
import org.thingsboard.server.queue.sqs.TbAwsSqsConsumerTemplate; |
|
|
|
import org.thingsboard.server.queue.sqs.TbAwsSqsProducerTemplate; |
|
|
|
@ -63,6 +64,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
private final PartitionService partitionService; |
|
|
|
private final TbServiceInfoProvider serviceInfoProvider; |
|
|
|
private final TbQueueRemoteJsInvokeSettings jsInvokeSettings; |
|
|
|
private final TbQueueTransportNotificationSettings transportNotificationSettings; |
|
|
|
|
|
|
|
private final TbQueueAdmin coreAdmin; |
|
|
|
private final TbQueueAdmin ruleEngineAdmin; |
|
|
|
@ -77,7 +79,8 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
PartitionService partitionService, |
|
|
|
TbServiceInfoProvider serviceInfoProvider, |
|
|
|
TbQueueRemoteJsInvokeSettings jsInvokeSettings, |
|
|
|
TbAwsSqsQueueAttributes sqsQueueAttributes) { |
|
|
|
TbAwsSqsQueueAttributes sqsQueueAttributes, |
|
|
|
TbQueueTransportNotificationSettings transportNotificationSettings) { |
|
|
|
this.sqsSettings = sqsSettings; |
|
|
|
this.coreSettings = coreSettings; |
|
|
|
this.transportApiSettings = transportApiSettings; |
|
|
|
@ -85,6 +88,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
this.partitionService = partitionService; |
|
|
|
this.serviceInfoProvider = serviceInfoProvider; |
|
|
|
this.jsInvokeSettings = jsInvokeSettings; |
|
|
|
this.transportNotificationSettings = transportNotificationSettings; |
|
|
|
|
|
|
|
this.coreAdmin = new TbAwsSqsAdmin(sqsSettings, sqsQueueAttributes.getCoreAttributes()); |
|
|
|
this.ruleEngineAdmin = new TbAwsSqsAdmin(sqsSettings, sqsQueueAttributes.getRuleEngineAttributes()); |
|
|
|
@ -95,7 +99,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueProducer<TbProtoQueueMsg<ToTransportMsg>> createTransportNotificationsMsgProducer() { |
|
|
|
return new TbAwsSqsProducerTemplate<>(coreAdmin, sqsSettings, coreSettings.getTopic()); |
|
|
|
return new TbAwsSqsProducerTemplate<>(notificationAdmin, sqsSettings, transportNotificationSettings.getNotificationsTopic()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -105,7 +109,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueProducer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> createRuleEngineNotificationsMsgProducer() { |
|
|
|
return new TbAwsSqsProducerTemplate<>(ruleEngineAdmin, sqsSettings, ruleEngineSettings.getTopic()); |
|
|
|
return new TbAwsSqsProducerTemplate<>(notificationAdmin, sqsSettings, ruleEngineSettings.getTopic()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -115,7 +119,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> createTbCoreNotificationsMsgProducer() { |
|
|
|
return new TbAwsSqsProducerTemplate<>(coreAdmin, sqsSettings, coreSettings.getTopic()); |
|
|
|
return new TbAwsSqsProducerTemplate<>(notificationAdmin, sqsSettings, coreSettings.getTopic()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -139,7 +143,7 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueProducer<TbProtoQueueMsg<TransportApiResponseMsg>> createTransportApiResponseProducer() { |
|
|
|
return new TbAwsSqsProducerTemplate<>(coreAdmin, sqsSettings, coreSettings.getTopic()); |
|
|
|
return new TbAwsSqsProducerTemplate<>(transportApiAdmin, sqsSettings, transportApiSettings.getResponsesTopic()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -172,13 +176,13 @@ public class AwsSqsTbCoreQueueFactory implements TbCoreQueueFactory { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueConsumer<TbProtoQueueMsg<ToUsageStatsServiceMsg>> createToUsageStatsServiceMsgConsumer() { |
|
|
|
return new TbAwsSqsConsumerTemplate<>(transportApiAdmin, sqsSettings, coreSettings.getUsageStatsTopic(), |
|
|
|
return new TbAwsSqsConsumerTemplate<>(coreAdmin, sqsSettings, coreSettings.getUsageStatsTopic(), |
|
|
|
msg -> new TbProtoQueueMsg<>(msg.getKey(), ToUsageStatsServiceMsg.parseFrom(msg.getData()), msg.getHeaders())); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueConsumer<TbProtoQueueMsg<ToOtaPackageStateServiceMsg>> createToOtaPackageStateServiceMsgConsumer() { |
|
|
|
return new TbAwsSqsConsumerTemplate<>(transportApiAdmin, sqsSettings, coreSettings.getOtaPackageTopic(), |
|
|
|
return new TbAwsSqsConsumerTemplate<>(coreAdmin, sqsSettings, coreSettings.getOtaPackageTopic(), |
|
|
|
msg -> new TbProtoQueueMsg<>(msg.getKey(), ToOtaPackageStateServiceMsg.parseFrom(msg.getData()), msg.getHeaders())); |
|
|
|
} |
|
|
|
|
|
|
|
|