optimized topicName creation in HashPartitionService
This commit is contained in:
parent
603be29f1b
commit
15e6190a9d
@ -103,11 +103,11 @@ public class HashPartitionService implements PartitionService {
|
|||||||
this.hashFunction = forName(hashFunctionName);
|
this.hashFunction = forName(hashFunctionName);
|
||||||
QueueKey coreKey = new QueueKey(ServiceType.TB_CORE);
|
QueueKey coreKey = new QueueKey(ServiceType.TB_CORE);
|
||||||
partitionSizesMap.put(coreKey, corePartitions);
|
partitionSizesMap.put(coreKey, corePartitions);
|
||||||
partitionTopicsMap.put(coreKey, topicService.buildTopicName(coreTopic));
|
partitionTopicsMap.put(coreKey, coreTopic);
|
||||||
|
|
||||||
QueueKey vcKey = new QueueKey(ServiceType.TB_VC_EXECUTOR);
|
QueueKey vcKey = new QueueKey(ServiceType.TB_VC_EXECUTOR);
|
||||||
partitionSizesMap.put(vcKey, vcPartitions);
|
partitionSizesMap.put(vcKey, vcPartitions);
|
||||||
partitionTopicsMap.put(vcKey, topicService.buildTopicName(vcTopic));
|
partitionTopicsMap.put(vcKey, vcTopic);
|
||||||
|
|
||||||
if (!isTransport(serviceInfoProvider.getServiceType())) {
|
if (!isTransport(serviceInfoProvider.getServiceType())) {
|
||||||
doInitRuleEnginePartitions();
|
doInitRuleEnginePartitions();
|
||||||
@ -125,7 +125,7 @@ public class HashPartitionService implements PartitionService {
|
|||||||
List<QueueRoutingInfo> queueRoutingInfoList = getQueueRoutingInfos();
|
List<QueueRoutingInfo> queueRoutingInfoList = getQueueRoutingInfos();
|
||||||
queueRoutingInfoList.forEach(queue -> {
|
queueRoutingInfoList.forEach(queue -> {
|
||||||
QueueKey queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, queue);
|
QueueKey queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, queue);
|
||||||
partitionTopicsMap.put(queueKey, topicService.buildTopicName(queue.getQueueTopic()));
|
partitionTopicsMap.put(queueKey, queue.getQueueTopic());
|
||||||
partitionSizesMap.put(queueKey, queue.getPartitions());
|
partitionSizesMap.put(queueKey, queue.getPartitions());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ public class HashPartitionService implements PartitionService {
|
|||||||
|
|
||||||
private TopicPartitionInfo buildTopicPartitionInfo(QueueKey queueKey, int partition) {
|
private TopicPartitionInfo buildTopicPartitionInfo(QueueKey queueKey, int partition) {
|
||||||
TopicPartitionInfo.TopicPartitionInfoBuilder tpi = TopicPartitionInfo.builder();
|
TopicPartitionInfo.TopicPartitionInfoBuilder tpi = TopicPartitionInfo.builder();
|
||||||
tpi.topic(partitionTopicsMap.get(queueKey));
|
tpi.topic(topicService.buildTopicName(partitionTopicsMap.get(queueKey)));
|
||||||
tpi.partition(partition);
|
tpi.partition(partition);
|
||||||
tpi.tenantId(queueKey.getTenantId());
|
tpi.tenantId(queueKey.getTenantId());
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class TopicService {
|
public class TopicService {
|
||||||
|
|
||||||
@Value("${queue.prefix}")
|
@Value("${queue.prefix:}")
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
|
||||||
private Map<String, TopicPartitionInfo> tbCoreNotificationTopics = new HashMap<>();
|
private Map<String, TopicPartitionInfo> tbCoreNotificationTopics = new HashMap<>();
|
||||||
@ -57,8 +57,8 @@ public class TopicService {
|
|||||||
return buildTopicPartitionInfo(serviceType.name().toLowerCase() + ".notifications." + serviceId, null, null, false);
|
return buildTopicPartitionInfo(serviceType.name().toLowerCase() + ".notifications." + serviceId, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TopicPartitionInfo buildTopicPartitionInfo(String topic, TenantId tenantId, Integer partition, boolean myPartiotion) {
|
public TopicPartitionInfo buildTopicPartitionInfo(String topic, TenantId tenantId, Integer partition, boolean myPartition) {
|
||||||
return new TopicPartitionInfo(buildTopicName(topic), tenantId, partition, myPartiotion);
|
return new TopicPartitionInfo(buildTopicName(topic), tenantId, partition, myPartition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String buildTopicName(String topic) {
|
public String buildTopicName(String topic) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user