This is an automated email from the ASF dual-hosted git repository.
yukon pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 91ccfeb2f When the proxy starts, the log displays the configuration
details (#6453)
91ccfeb2f is described below
commit 91ccfeb2f4dc15a83171e76fd1d086a307dae2a3
Author: Lobo Xu <[email protected]>
AuthorDate: Thu Mar 23 18:57:53 2023 +0800
When the proxy starts, the log displays the configuration details (#6453)
---
proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java | 2 ++
.../org/apache/rocketmq/proxy/config/ConfigurationManager.java | 7 +++++++
.../org/apache/rocketmq/proxy/service/route/TopicRouteService.java | 2 +-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
b/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
index 8cbd55fcd..d7aaffd20 100644
--- a/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
+++ b/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
@@ -116,6 +116,8 @@ public class ProxyStartup {
ConfigurationManager.initEnv();
ConfigurationManager.intConfig();
setConfigFromCommandLineArgument(commandLineArgument);
+ log.info("Current configuration: " +
ConfigurationManager.formatProxyConfig());
+
}
protected static CommandLineArgument parseCommandLineArgument(String[]
args) {
diff --git
a/proxy/src/main/java/org/apache/rocketmq/proxy/config/ConfigurationManager.java
b/proxy/src/main/java/org/apache/rocketmq/proxy/config/ConfigurationManager.java
index 7c16b2d32..911e1f28f 100644
---
a/proxy/src/main/java/org/apache/rocketmq/proxy/config/ConfigurationManager.java
+++
b/proxy/src/main/java/org/apache/rocketmq/proxy/config/ConfigurationManager.java
@@ -17,6 +17,8 @@
package org.apache.rocketmq.proxy.config;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.common.MixAll;
@@ -49,4 +51,9 @@ public class ConfigurationManager {
public static ProxyConfig getProxyConfig() {
return configuration.getProxyConfig();
}
+
+ public static String formatProxyConfig() {
+ return JSON.toJSONString(ConfigurationManager.getProxyConfig(),
+ SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat,
SerializerFeature.WriteNullListAsEmpty);
+ }
}
diff --git
a/proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java
b/proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java
index 93ce7d4d0..8a4046e45 100644
---
a/proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java
+++
b/proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java
@@ -125,7 +125,7 @@ public abstract class TopicRouteService extends
AbstractStartAndShutdown {
protected static MessageQueueView
getCacheMessageQueueWrapper(LoadingCache<String, MessageQueueView> topicCache,
String key) throws Exception {
MessageQueueView res = topicCache.get(key);
- if (res.isEmptyCachedQueue()) {
+ if (res != null && res.isEmptyCachedQueue()) {
throw new MQClientException(ResponseCode.TOPIC_NOT_EXIST,
"No topic route info in name server for the topic: " + key);
}