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/22 04:15:10 UTC

[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4348: [ISSUE #4323] OrderMessage example add the default NamesrvAddr

Oliverwqcwrw commented on code in PR #4348:
URL: https://github.com/apache/rocketmq/pull/4348#discussion_r878790514


##########
example/src/main/java/org/apache/rocketmq/example/ordermessage/Producer.java:
##########
@@ -19,35 +19,38 @@
 import org.apache.rocketmq.client.exception.MQBrokerException;
 import org.apache.rocketmq.client.exception.MQClientException;
 import org.apache.rocketmq.client.producer.DefaultMQProducer;
-import org.apache.rocketmq.client.producer.MessageQueueSelector;
 import org.apache.rocketmq.client.producer.SendResult;
 import org.apache.rocketmq.common.message.Message;
-import org.apache.rocketmq.common.message.MessageQueue;
 import org.apache.rocketmq.remoting.common.RemotingHelper;
 import org.apache.rocketmq.remoting.exception.RemotingException;
 
 import java.io.UnsupportedEncodingException;
-import java.util.List;
 
 public class Producer {
+
+    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 int MESSAGE_COUNT = 100;
+
     public static void main(String[] args) throws UnsupportedEncodingException {
         try {
-            DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
+            DefaultMQProducer producer = new DefaultMQProducer(PRODUCER_GROUP);
+
+            // If the debugging source code can open comments, you need to set the namesrvAddr to the address of the local namesrvAddr
+//            producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

Review Comment:
   ```suggestion
             //  producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);
   ```
   My obsessive compulsive disorder



##########
example/src/main/java/org/apache/rocketmq/example/ordermessage/Consumer.java:
##########
@@ -28,12 +28,19 @@
 
 public class Consumer {
 
+    public static final String CONSUMER_GROUP = "please_rename_unique_group_name_3";
+    public static final String DEFAULT_NAMESRVADDR = "127.0.0.1:9876";
+    public static final String TOPIC = "TopicTest";
+    public static final String SUB_EXPRESSION = "TagA || TagC || TagD";
+
     public static void main(String[] args) throws MQClientException {
-        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("please_rename_unique_group_name_3");
+        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(CONSUMER_GROUP);
 
+        // If the debugging source code can open comments, you need to set the namesrvAddr to the address of the local namesrvAddr
+//        consumer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

Review Comment:
   ```suggestion
         //  consumer.setNamesrvAddr(DEFAULT_NAMESRVADDR);
   ```
   My obsessive compulsive disorder



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