|
|
|
@ -187,18 +187,27 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueConsumer<TbProtoQueueMsg<ToRuleEngineMsg>> createToRuleEngineMsgConsumer(Queue configuration) { |
|
|
|
throw new UnsupportedOperationException("Rule engine consumer should use a partitionId"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueConsumer<TbProtoQueueMsg<ToRuleEngineMsg>> createToRuleEngineMsgConsumer(Queue configuration, Integer partitionId) { |
|
|
|
String queueName = configuration.getName(); |
|
|
|
TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder<TbProtoQueueMsg<ToRuleEngineMsg>> consumerBuilder = TbKafkaConsumerTemplate.builder(); |
|
|
|
consumerBuilder.settings(kafkaSettings); |
|
|
|
consumerBuilder.topic(topicService.buildTopicName(configuration.getTopic())); |
|
|
|
consumerBuilder.clientId("re-" + queueName + "-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); |
|
|
|
consumerBuilder.groupId(topicService.buildTopicName("re-" + queueName + (configuration.getTenantId().isSysTenantId() ? "" : ("-isolated-" + configuration.getTenantId())) + "-consumer")); |
|
|
|
consumerBuilder.groupId(topicService.buildTopicName("re-" + queueName |
|
|
|
+ (configuration.getTenantId().isSysTenantId() ? "" : ("-isolated-" + configuration.getTenantId())) |
|
|
|
+ "-consumer" |
|
|
|
+ topicService.suffix(partitionId))); |
|
|
|
consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToRuleEngineMsg.parseFrom(msg.getData()), msg.getHeaders())); |
|
|
|
consumerBuilder.admin(ruleEngineAdmin); |
|
|
|
consumerBuilder.statsService(consumerStatsService); |
|
|
|
return consumerBuilder.build(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TbQueueConsumer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> createToRuleEngineNotificationsMsgConsumer() { |
|
|
|
TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> consumerBuilder = TbKafkaConsumerTemplate.builder(); |
|
|
|
|