Skip to content

Commit

Permalink
Fix the issue of sending message "No route information of this topic:…
Browse files Browse the repository at this point in the history
… xxx" when the producer does not configure the namespace
  • Loading branch information
aoshiguchen authored Feb 19, 2024
1 parent 1984e07 commit a918020
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public DefaultMQProducer defaultMQProducer(RocketMQProperties rocketMQProperties
producer.setCompressMsgBodyOverHowmuch(producerConfig.getCompressMessageBodyThreshold());
producer.setRetryAnotherBrokerWhenNotStoreOK(producerConfig.isRetryNextServer());
producer.setUseTLS(producerConfig.isTlsEnable());
producer.setNamespace(producerConfig.getNamespace());
if (StringUtils.hasText(producerConfig.getNamespace())) {
producer.setNamespace(producerConfig.getNamespace());
}
producer.setInstanceName(producerConfig.getInstanceName());
log.info("a producer ({}) init on namesrv {}", groupName, nameServer);
return producer;
Expand Down Expand Up @@ -147,7 +149,9 @@ public DefaultLitePullConsumer defaultLitePullConsumer(RocketMQProperties rocket
groupName, topicName, messageModel, selectorType, selectorExpression, ak, sk, pullBatchSize, useTLS);
litePullConsumer.setEnableMsgTrace(consumerConfig.isEnableMsgTrace());
litePullConsumer.setCustomizedTraceTopic(consumerConfig.getCustomizedTraceTopic());
litePullConsumer.setNamespace(consumerConfig.getNamespace());
if (StringUtils.hasText(consumerConfig.getNamespace())) {
litePullConsumer.setNamespace(consumerConfig.getNamespace());
}
litePullConsumer.setInstanceName(consumerConfig.getInstanceName());
log.info("a pull consumer({} sub {}) init on namesrv {}", groupName, topicName, nameServer);
return litePullConsumer;
Expand Down Expand Up @@ -182,4 +186,4 @@ static class DefaultMQProducerExistsCondition {
static class DefaultLitePullConsumerExistsCondition {
}
}
}
}

0 comments on commit a918020

Please sign in to comment.