HScarb commented on code in PR #4352:
URL: https://github.com/apache/rocketmq/pull/4352#discussion_r878979416


##########
example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:
##########
@@ -17,31 +17,33 @@
 package org.apache.rocketmq.example.schedule;
 
 import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
-import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
 import 
org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
 import org.apache.rocketmq.common.message.MessageExt;
 
-import java.util.List;
-
 public class ScheduledMessageConsumer {
-    
+
+    public static final String CONSUMER_GROUP = "ExampleConsumer";
+    public static final String DEFAULT_NAMESRVADDR = "127.0.0.1:9876";
+    public static final String TOPIC = "TestTopic";
+
     public static void main(String[] args) throws Exception {
         // Instantiate message consumer
-        DefaultMQPushConsumer consumer = new 
DefaultMQPushConsumer("ExampleConsumer");
+        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);
+
         // Subscribe topics
-        consumer.subscribe("TestTopic", "*");
+        consumer.subscribe(TOPIC, "*");
         // Register message listener
-        consumer.registerMessageListener(new MessageListenerConcurrently() {
-            @Override
-            public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> 
messages, ConsumeConcurrentlyContext context) {
-                for (MessageExt message : messages) {
-                    // Print approximate delay time period
-                    System.out.printf("Receive message[msgId=%s %d  ms 
later]\n", message.getMsgId(),
-                            System.currentTimeMillis() - 
message.getStoreTimestamp());
-                }
-                return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+        consumer.registerMessageListener((MessageListenerConcurrently) 
(messages, context) -> {

Review Comment:
   Think this code is suppose to compile under jdk 1.7, so lambda may not 
supported



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to