rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinrongt...@apache.org
Subject [rocketmq-spring.wiki] branch master updated: Created Consume Message (markdown)
Date Wed, 25 Dec 2019 08:07:07 GMT
This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-spring.wiki.git


The following commit(s) were added to refs/heads/master by this push:
     new 45d8a77  Created Consume Message (markdown)
45d8a77 is described below

commit 45d8a77894980cb3dfbef43869b3bd33146f426c
Author: rongtong <jinrongtong5@163.com>
AuthorDate: Wed Dec 25 16:07:01 2019 +0800

    Created Consume Message (markdown)
---
 Consume-Message.md | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/Consume-Message.md b/Consume-Message.md
new file mode 100644
index 0000000..6604365
--- /dev/null
+++ b/Consume-Message.md
@@ -0,0 +1,41 @@
+Modify application.properties
+```properties
+## application.properties
+rocketmq.name-server=127.0.0.1:9876
+```
+
+> Note:
+> 
+> Maybe you need change `127.0.0.1:9876` with your real NameServer address for RocketMQ
+
+```java
+@SpringBootApplication
+public class ConsumerApplication{
+    
+    public static void main(String[] args){
+        SpringApplication.run(ConsumerApplication.class, args);
+    }
+    
+    @Slf4j
+    @Service
+    @RocketMQMessageListener(topic = "test-topic-1", consumerGroup = "my-consumer_test-topic-1")
+    public class MyConsumer1 implements RocketMQListener<String>{
+        public void onMessage(String message) {
+            log.info("received message: {}", message);
+        }
+    }
+    
+    @Slf4j
+    @Service
+    @RocketMQMessageListener(topic = "test-topic-2", consumerGroup = "my-consumer_test-topic-2")
+    public class MyConsumer2 implements RocketMQListener<OrderPaidEvent>{
+        public void onMessage(OrderPaidEvent orderPaidEvent) {
+            log.info("received orderPaidEvent: {}", orderPaidEvent);
+        }
+    }
+}
+```
+
+> More relevant configurations for consuming:
+>
+> see: [RocketMQMessageListener](rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/annotation/RocketMQMessageListener.java)
\ No newline at end of file


Mime
View raw message