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 2020/11/14 04:04:46 UTC

[GitHub] [rocketmq-spring] RongtongJin commented on a change in pull request #307: [ISSUE #306] Support real LitePullMessage in RocketMQ-Spring

RongtongJin commented on a change in pull request #307:
URL: https://github.com/apache/rocketmq-spring/pull/307#discussion_r523370633



##########
File path: rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQProperties.java
##########
@@ -230,6 +230,42 @@ public void setConsumer(Consumer consumer) {
     }
 
     public static final class Consumer {
+        /**
+         * Group name of consumer.
+         */
+        private String group;
+
+        /**
+         * Topic name of consumer.
+         */
+        private String topic;
+
+        /**
+         * Control message mode, if you want all subscribers receive message all message, broadcasting is a good choice.
+         */
+        private String  messageModel = "CLUSTERING";
+
+        /**
+         * Control how to selector message.
+         *
+         */
+        private String selectorType = "TAG";
+
+        /**
+         * Control which message can be select.
+         */
+        private String selectorExpression = "*";
+
+        /**
+         * The property of "access-key".
+         */
+        private String accessKey;
+
+        /**
+         * The property of "secret-key".
+         */
+        private String secretKey;
+

Review comment:
       It would be better to add a property in litePullConnsumer named pullBatchSize.

##########
File path: rocketmq-spring-boot-samples/rocketmq-consume-demo/src/main/java/org/apache/rocketmq/samples/springboot/ConsumerApplication.java
##########
@@ -17,17 +17,37 @@
 
 package org.apache.rocketmq.samples.springboot;
 
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * ConsumerApplication
  */
 @SpringBootApplication
-public class ConsumerApplication {
+public class ConsumerApplication implements CommandLineRunner {
+
+    @Resource
+    private RocketMQTemplate rocketMQTemplate;
+
+    @Resource(name = "extRocketMQTemplate")
+    private RocketMQTemplate extRocketMQTemplate;
 
     public static void main(String[] args) {
         SpringApplication.run(ConsumerApplication.class, args);
     }
+
+    @Override
+    public void run(String... args) throws Exception {
+        List<String> messages = rocketMQTemplate.receive(String.class);
+        System.out.printf("receive from rocketMQTemplate, messages=%s %n", messages);
+
+        messages = extRocketMQTemplate.receive(String.class);
+        System.out.printf("receive from extRocketMQTemplate, messages=%s %n", messages);
+    }

Review comment:
       It would better to add the following comment: This is an example of pull consumer for rocketmq-spring




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

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