You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2018/04/27 21:01:43 UTC

[rocketmq] branch develop updated: BugFix: access point parsed as name server address when enabled for push / pull consumers

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

lizhanhui 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 173f77d  BugFix: access point parsed as name server address when enabled for push / pull consumers
173f77d is described below

commit 173f77d2c32019c8f5884a3adeb78d6f83aaa55c
Author: Zhanhui Li <li...@apache.org>
AuthorDate: Sat Apr 28 05:01:29 2018 +0800

    BugFix: access point parsed as name server address when enabled for push / pull consumers
---
 .../io/openmessaging/rocketmq/consumer/PullConsumerImpl.java   | 10 ++++++----
 .../io/openmessaging/rocketmq/consumer/PushConsumerImpl.java   | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java b/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java
index 2e22509..c11da58 100644
--- a/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java
+++ b/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java
@@ -60,11 +60,13 @@ public class PullConsumerImpl implements PullConsumer {
 
         this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer();
 
-        String accessPoints = clientConfig.getAccessPoints();
-        if (accessPoints == null || accessPoints.isEmpty()) {
-            throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
+        if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) {
+            String accessPoints = clientConfig.getAccessPoints();
+            if (accessPoints == null || accessPoints.isEmpty()) {
+                throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
+            }
+            this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
         }
-        this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
 
         this.rocketmqPullConsumer.setConsumerGroup(consumerGroup);
 
diff --git a/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java b/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java
index 9bfd7c8..46f6775 100644
--- a/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java
+++ b/openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java
@@ -52,11 +52,13 @@ public class PushConsumerImpl implements PushConsumer {
         this.properties = properties;
         this.clientConfig = BeanUtils.populate(properties, ClientConfig.class);
 
-        String accessPoints = clientConfig.getAccessPoints();
-        if (accessPoints == null || accessPoints.isEmpty()) {
-            throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
+        if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) {
+            String accessPoints = clientConfig.getAccessPoints();
+            if (accessPoints == null || accessPoints.isEmpty()) {
+                throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
+            }
+            this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
         }
-        this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
 
         String consumerGroup = clientConfig.getConsumerId();
         if (null == consumerGroup || consumerGroup.isEmpty()) {

-- 
To stop receiving notification emails like this one, please contact
lizhanhui@apache.org.