You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "lizhanhui (via GitHub)" <gi...@apache.org> on 2023/03/24 02:15:56 UTC

[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #6463: [ISSUE #6462] Optimize PushConsumer code and logic

lizhanhui commented on code in PR #6463:
URL: https://github.com/apache/rocketmq/pull/6463#discussion_r1147051458


##########
example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java:
##########
@@ -26,10 +26,14 @@
 import org.apache.rocketmq.common.message.MessageExt;
 
 public class PushConsumer {
-
+    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 InterruptedException, MQClientException {
-        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("CID_JODIE_1");
-        consumer.subscribe("TopicTest", "*");
+
+        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(CONSUMER_GROUP);
+        consumer.setNamesrvAddr(NAMESRV_ADDR);

Review Comment:
   It's an example program and users may prefer to fill name server address through an environment variable or java options...hardcoding one may not be helpful



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org