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:11:38 UTC

[GitHub] [rocketmq] odbozhou commented on a diff in pull request #4328: [ISSUE #4323] Batch example add the default NamesrvAddr

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


##########
example/src/main/java/org/apache/rocketmq/example/batch/SplitBatchProducer.java:
##########
@@ -22,34 +22,44 @@
 import java.util.List;
 import java.util.Map;
 import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.SendResult;
 import org.apache.rocketmq.common.message.Message;
 
 public class SplitBatchProducer {
 
+    public static final String PRODUCER_GROUP = "BatchProducerGroupName";
+    public static final String DEFAULT_NAMESRVADDR = "127.0.0.1:9876";
+
+    public static final int MESSAGE_COUNT = 100 * 1000;
+    public static final String TOPIC = "BatchTest";
+    public static final String TAG = "Tag";
+
     public static void main(String[] args) throws Exception {
 
-        DefaultMQProducer producer = new DefaultMQProducer("BatchProducerGroupName");
+        DefaultMQProducer producer = new DefaultMQProducer(PRODUCER_GROUP);
+        //You need to set namesrvAddr to the address of the local namesrv

Review Comment:
   May cause the official website quick start to set namesrv through the command line to fail.
   
   ![image](https://user-images.githubusercontent.com/14222167/169222247-c94c3a0d-2a74-4a72-9253-afdaf04e313c.png)
   



##########
example/src/main/java/org/apache/rocketmq/example/batch/SimpleBatchProducer.java:
##########
@@ -20,22 +20,30 @@
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.SendResult;
 import org.apache.rocketmq.common.message.Message;
 
 public class SimpleBatchProducer {
 
+    public static final String PRODUCER_GROUP = "BatchProducerGroupName";
+    public static final String DEFAULT_NAMESRVADDR = "127.0.0.1:9876";
+    public static final String TOPIC = "BatchTest";
+    public static final String TAG = "Tag";
+
     public static void main(String[] args) throws Exception {
-        DefaultMQProducer producer = new DefaultMQProducer("BatchProducerGroupName");
+        DefaultMQProducer producer = new DefaultMQProducer(PRODUCER_GROUP);
+        //You need to set namesrvAddr to the address of the local namesrv
+        producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

Review Comment:
   May cause the official website quick start to set namesrv through the command line to fail.
   
   ![image](https://user-images.githubusercontent.com/14222167/169222247-c94c3a0d-2a74-4a72-9253-afdaf04e313c.png)
   



-- 
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