Skip to content

Commit 173f77d

Browse files
committed
BugFix: access point parsed as name server address when enabled for push / pull consumers
1 parent 6124695 commit 173f77d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ public PullConsumerImpl(final KeyValue properties) {
6060

6161
this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer();
6262

63-
String accessPoints = clientConfig.getAccessPoints();
64-
if (accessPoints == null || accessPoints.isEmpty()) {
65-
throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
63+
if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) {
64+
String accessPoints = clientConfig.getAccessPoints();
65+
if (accessPoints == null || accessPoints.isEmpty()) {
66+
throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
67+
}
68+
this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
6669
}
67-
this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
6870

6971
this.rocketmqPullConsumer.setConsumerGroup(consumerGroup);
7072

openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ public PushConsumerImpl(final KeyValue properties) {
5252
this.properties = properties;
5353
this.clientConfig = BeanUtils.populate(properties, ClientConfig.class);
5454

55-
String accessPoints = clientConfig.getAccessPoints();
56-
if (accessPoints == null || accessPoints.isEmpty()) {
57-
throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
55+
if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) {
56+
String accessPoints = clientConfig.getAccessPoints();
57+
if (accessPoints == null || accessPoints.isEmpty()) {
58+
throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty.");
59+
}
60+
this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
5861
}
59-
this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',', ';'));
6062

6163
String consumerGroup = clientConfig.getConsumerId();
6264
if (null == consumerGroup || consumerGroup.isEmpty()) {

0 commit comments

Comments
 (0)