You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/05/19 06:19:59 UTC

[GitHub] [rocketmq] odbozhou commented on a diff in pull request #4322: [ISSUE #4323] Quickstart adds the default NamesrvAddr

odbozhou commented on code in PR #4322:
URL: https://github.com/apache/rocketmq/pull/4322#discussion_r876647708


##########
example/src/main/java/org/apache/rocketmq/example/quickstart/Consumer.java:
##########
@@ -48,6 +49,7 @@ public static void main(String[] args) throws InterruptedException, MQClientExce
          * }
          * </pre>
          */
+        consumer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

Review Comment:
   May cause the official website quick start to set namesrv through the command line to fail.



##########
example/src/main/java/org/apache/rocketmq/example/quickstart/Producer.java:
##########
@@ -26,38 +26,48 @@
  * This class demonstrates how to send messages to brokers using provided {@link DefaultMQProducer}.
  */
 public class Producer {
+
+    /**
+     * The number of produced messages.
+     */
+    public static final int MESSAGE_COUNT = 1000;
+    public static final String PRODUCER_GROUP = "please_rename_unique_group_name";
+    public static final String DEFAULT_NAMESRVADDR = "127.0.0.1:9876";
+    public static final String TOPIC = "TopicTest";
+    public static final String TAG = "TagA";
+
     public static void main(String[] args) throws MQClientException, InterruptedException {
 
         /*
          * Instantiate with a producer group name.
          */
-        DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
+        DefaultMQProducer producer = new DefaultMQProducer(PRODUCER_GROUP);
 
         /*
          * Specify name server addresses.
-         * <p/>
          *
          * Alternatively, you may specify name server addresses via exporting environmental variable: NAMESRV_ADDR
          * <pre>
          * {@code
-         * producer.setNamesrvAddr("name-server1-ip:9876;name-server2-ip:9876");
+         *  producer.setNamesrvAddr("name-server1-ip:9876;name-server2-ip:9876");
          * }
          * </pre>
          */
+        producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

Review Comment:
   May cause the official website quick start to set namesrv through the command line to fail.



-- 
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: dev-unsubscribe@rocketmq.apache.org

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