This is an automated email from the ASF dual-hosted git repository. lizhimin 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 ad60f33251 [ISSUE #9223] Pop consumer example add the default NamesrvAddr (#9224) ad60f33251 is described below commit ad60f3325111ad62872a9568ce9f703daaf85242 Author: hqbfz <125714719+3424672...@users.noreply.github.com> AuthorDate: Fri Mar 7 13:47:35 2025 +0800 [ISSUE #9223] Pop consumer example add the default NamesrvAddr (#9224) --- .../src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java b/example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java index 6321e36d9a..f3edc5c1a0 100644 --- a/example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java +++ b/example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java @@ -32,6 +32,7 @@ import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; public class PopConsumer { public static final String TOPIC = "TopicTest"; public static final String CONSUMER_GROUP = "CID_JODIE_1"; + public static final String NAMESRV_ADDR = "127.0.0.1:9876"; public static void main(String[] args) throws Exception { switchPop(); DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(CONSUMER_GROUP); @@ -44,12 +45,15 @@ public class PopConsumer { return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; } }); + // Uncomment the following line while debugging, namesrvAddr should be set to your local address + // consumer.setNamesrvAddr(NAMESRV_ADDR); consumer.setClientRebalance(false); consumer.start(); System.out.printf("Consumer Started.%n"); } private static void switchPop() throws Exception { DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); + // mqAdminExt.setNamesrvAddr(NAMESRV_ADDR); mqAdminExt.start(); List<BrokerData> brokerDatas = mqAdminExt.examineTopicRouteInfo(TOPIC).getBrokerDatas(); for (BrokerData brokerData : brokerDatas) {