This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-spring.git


The following commit(s) were added to refs/heads/master by this push:
     new a918020  Fix the issue of sending message "No route information of 
this topic: xxx" when the producer does not configure the namespace
a918020 is described below

commit a918020d38f7ac241381fcbb4cbeada62810be40
Author: aoshiguchen <aoshiguc...@gmail.com>
AuthorDate: Mon Feb 19 14:07:43 2024 +0800

    Fix the issue of sending message "No route information of this topic: xxx" 
when the producer does not configure the namespace
---
 .../spring/autoconfigure/RocketMQAutoConfiguration.java        | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
 
b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
index 9ed8ad9..1bf9764 100644
--- 
a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
+++ 
b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQAutoConfiguration.java
@@ -115,7 +115,9 @@ public class RocketMQAutoConfiguration implements 
ApplicationContextAware {
         
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;
@@ -147,7 +149,9 @@ public class RocketMQAutoConfiguration implements 
ApplicationContextAware {
                 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;
@@ -182,4 +186,4 @@ public class RocketMQAutoConfiguration implements 
ApplicationContextAware {
         static class DefaultLitePullConsumerExistsCondition {
         }
     }
-}
\ No newline at end of file
+}

Reply via email to