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


The following commit(s) were added to refs/heads/master by this push:
     new 0a0a931  [ISSUE #660] Add simple sample demo (#661)
0a0a931 is described below

commit 0a0a931406a027bf3f784df847f2f21c625c1cc2
Author: Zhouxiang Zhan <[email protected]>
AuthorDate: Fri May 31 16:41:15 2024 +0800

    [ISSUE #660] Add simple sample demo (#661)
    
    * Add simple sample demo
---
 rocketmq-spring-boot-samples/pom.xml               |  6 ++-
 .../rocketmq-consumer-pull-simple-demo/pom.xml     | 34 +++++++++++++++
 .../springboot/PullConsumerApplication.java        | 44 +++++++++++++++++++
 .../src/main/resources/application.properties      | 21 ++++++++++
 .../rocketmq-consumer-push-simple-demo/pom.xml     | 34 +++++++++++++++
 .../springboot/PushConsumerApplication.java        | 45 ++++++++++++++++++++
 .../src/main/resources/application.properties      | 19 +++++++++
 .../rocketmq-producer-simple-demo/pom.xml          | 34 +++++++++++++++
 .../samples/springboot/ProducerApplication.java    | 45 ++++++++++++++++++++
 .../src/main/resources/application.properties      | 21 ++++++++++
 rocketmq-v5-client-spring-boot-samples/pom.xml     |  8 ++--
 .../pom.xml                                        | 36 ++++++++++++++++
 .../V5PushConsumerConsumerApplication.java         | 49 ++++++++++++++++++++++
 .../src/main/resources/application.properties      | 19 +++++++++
 .../pom.xml                                        | 34 +++++++++++++++
 .../V5SimpleConsumerConsumerApplication.java       | 45 ++++++++++++++++++++
 .../src/main/resources/application.properties      | 21 ++++++++++
 .../pom.xml                                        | 34 +++++++++++++++
 .../samples/springboot/V5ProducerApplication.java  | 45 ++++++++++++++++++++
 .../src/main/resources/application.properties      | 19 +++++++++
 20 files changed, 608 insertions(+), 5 deletions(-)

diff --git a/rocketmq-spring-boot-samples/pom.xml 
b/rocketmq-spring-boot-samples/pom.xml
index 1ca7438..7e2c9bd 100644
--- a/rocketmq-spring-boot-samples/pom.xml
+++ b/rocketmq-spring-boot-samples/pom.xml
@@ -35,19 +35,21 @@
         <module>rocketmq-consume-demo</module>
         <module>rocketmq-produce-acl-demo</module>
         <module>rocketmq-consume-acl-demo</module>
+        <module>rocketmq-producer-simple-demo</module>
+        <module>rocketmq-consumer-pull-simple-demo</module>
+        <module>rocketmq-consumer-push-simple-demo</module>
     </modules>
 
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        
<rocketmq-spring-boot-starter-version>2.3.1-SNAPSHOT</rocketmq-spring-boot-starter-version>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>rocketmq-spring-boot-starter</artifactId>
-            <version>${rocketmq-spring-boot-starter-version}</version>
+            <version>${project.version}</version>
         </dependency>
     </dependencies>
 
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/pom.xml 
b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/pom.xml
new file mode 100644
index 0000000..a23c754
--- /dev/null
+++ b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-consumer-pull-simple-demo</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PullConsumerApplication.java
 
b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PullConsumerApplication.java
new file mode 100644
index 0000000..a88cc4d
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PullConsumerApplication.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+
+import java.util.List;
+import javax.annotation.Resource;
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class PullConsumerApplication implements CommandLineRunner {
+    @Resource
+    private RocketMQTemplate rocketMQTemplate;
+
+    public static void main(String[] args) {
+        SpringApplication.run(PullConsumerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) {
+        for (int i = 0; i < 100; i++) {
+            List<String> messages = rocketMQTemplate.receive(String.class);
+            System.out.println(messages);
+        }
+    }
+}
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/resources/application.properties
 
b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..cc51b58
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-consumer-pull-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.name-server=localhost:9876
+
+rocketmq.pull-consumer.group=demo-group
+rocketmq.pull-consumer.topic=demo-topic
+#rocketmq.pull-consumer.access-key=
+#rocketmq.pull-consumer.secret-key=
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/pom.xml 
b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/pom.xml
new file mode 100644
index 0000000..db3efce
--- /dev/null
+++ b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-consumer-push-simple-demo</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PushConsumerApplication.java
 
b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PushConsumerApplication.java
new file mode 100644
index 0000000..213f104
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/PushConsumerApplication.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.spring.core.RocketMQListener;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.stereotype.Service;
+
+@SpringBootApplication
+public class PushConsumerApplication implements CommandLineRunner {
+
+    public static void main(String[] args) {
+        SpringApplication.run(PushConsumerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) {
+    }
+
+    @Service
+    @RocketMQMessageListener(topic = "demo-topic", consumerGroup = 
"demo-group")
+    public static class DemoConsumer implements RocketMQListener<String> {
+        public void onMessage(String message) {
+            System.out.println("received message: " + message);
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/resources/application.properties
 
b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..531e6dc
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-consumer-push-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.name-server=localhost:9876
+
+#rocketmq.consumer.access-key=
+#rocketmq.consumer.secret-key=
\ No newline at end of file
diff --git a/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/pom.xml 
b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/pom.xml
new file mode 100644
index 0000000..d369168
--- /dev/null
+++ b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-producer-simple-demo</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java
 
b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java
new file mode 100644
index 0000000..6abe10c
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+import javax.annotation.Resource;
+import org.apache.rocketmq.client.producer.SendResult;
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ProducerApplication implements CommandLineRunner {
+    @Resource
+    private RocketMQTemplate rocketMQTemplate;
+
+    @Value("${rocketmq.producer.simple.demo.topic}")
+    private String topic;
+
+    public static void main(String[] args) {
+        SpringApplication.run(ProducerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) {
+        SendResult sendResult = rocketMQTemplate.syncSend(topic, "Hello, 
World!");
+        System.out.println(sendResult);
+    }
+}
\ No newline at end of file
diff --git 
a/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/resources/application.properties
 
b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..5616649
--- /dev/null
+++ 
b/rocketmq-spring-boot-samples/rocketmq-producer-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.name-server=localhost:9876
+
+rocketmq.producer.simple.demo.topic=demo-topic
+rocketmq.producer.group=demo-group
+#rocketmq.producer.access-key=
+#rocketmq.producer.secret-key=
\ No newline at end of file
diff --git a/rocketmq-v5-client-spring-boot-samples/pom.xml 
b/rocketmq-v5-client-spring-boot-samples/pom.xml
index fba5232..99ae98b 100644
--- a/rocketmq-v5-client-spring-boot-samples/pom.xml
+++ b/rocketmq-v5-client-spring-boot-samples/pom.xml
@@ -32,12 +32,14 @@
                <module>rocketmq-v5-client-consume-demo</module>
                <module>rocketmq-v5-client-consume-acl-demo</module>
                <module>rocketmq-v5-client-producer-acl-demo</module>
-       </modules>
+        <module>rocketmq-v5-client-producer-simple-demo</module>
+        <module>rocketmq-v5-client-consumer-simple-demo</module>
+        <module>rocketmq-v5-client-consumer-push-simple-demo</module>
+    </modules>
 
        <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
-               
<rocketmq-v5-client-spring-boot-starter-version>2.2.4-SNAPSHOT</rocketmq-v5-client-spring-boot-starter-version>
                <commons-logging-version>1.3.0</commons-logging-version>
        </properties>
 
@@ -46,7 +48,7 @@
                <dependency>
                        <groupId>org.apache.rocketmq</groupId>
                        
<artifactId>rocketmq-v5-client-spring-boot-starter</artifactId>
-                       
<version>${rocketmq-v5-client-spring-boot-starter-version}</version>
+                       <version>${project.version}</version>
                </dependency>
                <dependency>
                        <groupId>commons-logging</groupId>
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/pom.xml
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/pom.xml
new file mode 100644
index 0000000..a31aa3b
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-v5-client-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-v5-client-consumer-push-simple-demo</artifactId>
+
+    <properties>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5PushConsumerConsumerApplication.java
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5PushConsumerConsumerApplication.java
new file mode 100644
index 0000000..ddce695
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5PushConsumerConsumerApplication.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+import org.apache.rocketmq.client.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.client.apis.consumer.ConsumeResult;
+import org.apache.rocketmq.client.apis.message.MessageView;
+import org.apache.rocketmq.client.core.RocketMQListener;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.stereotype.Service;
+
+@SpringBootApplication
+public class V5PushConsumerConsumerApplication implements CommandLineRunner {
+
+    public static void main(String[] args) {
+        SpringApplication.run(V5PushConsumerConsumerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) {
+    }
+
+    @Service
+    @RocketMQMessageListener(consumerGroup="demo-group", topic="demo-topic")
+    public class MyConsumer1 implements RocketMQListener {
+        @Override
+        public ConsumeResult consume(MessageView messageView) {
+            System.out.println("received message: " + messageView);
+            return ConsumeResult.SUCCESS;
+        }
+    }
+}
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/resources/application.properties
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..f7d191c
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-push-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.push-consumer.endpoints=localhost:8081
+rocketmq.push-consumer.tag=*
+#rocketmq.push-consumer.access-key=
+#rocketmq.push-consumer.secret-key=
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/pom.xml
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/pom.xml
new file mode 100644
index 0000000..93bea99
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-v5-client-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-v5-client-consumer-simple-demo</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5SimpleConsumerConsumerApplication.java
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5SimpleConsumerConsumerApplication.java
new file mode 100644
index 0000000..ede26b1
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5SimpleConsumerConsumerApplication.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+import java.time.Duration;
+import java.util.List;
+import javax.annotation.Resource;
+import org.apache.rocketmq.client.apis.message.MessageView;
+import org.apache.rocketmq.client.core.RocketMQClientTemplate;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class V5SimpleConsumerConsumerApplication implements CommandLineRunner {
+    @Resource
+    private RocketMQClientTemplate rocketMQClientTemplate;
+
+    public static void main(String[] args) {
+        SpringApplication.run(V5SimpleConsumerConsumerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) throws Exception {
+        for (int i = 0; i < 10; i++) {
+            List<MessageView> messageList = rocketMQClientTemplate.receive(10, 
Duration.ofSeconds(60));
+            System.out.println(messageList);
+        }
+    }
+}
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/resources/application.properties
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..5614721
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-consumer-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.simple-consumer.endpoints=localhost:8081
+rocketmq.simple-consumer.consumer-group=demo-group
+rocketmq.simple-consumer.topic=demo-topic
+rocketmq.simple-consumer.tag=*
+#rocketmq.simple-consumer.access-key=
+#rocketmq.simple-consumer.secret-key=
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/pom.xml
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/pom.xml
new file mode 100644
index 0000000..7058f89
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>rocketmq-v5-client-spring-boot-samples</artifactId>
+        <version>2.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>rocketmq-v5-client-producer-simple-demo</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>
\ No newline at end of file
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5ProducerApplication.java
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5ProducerApplication.java
new file mode 100644
index 0000000..62d7cfd
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/java/org/apache/rocketmq/samples/springboot/V5ProducerApplication.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.samples.springboot;
+
+import javax.annotation.Resource;
+import org.apache.rocketmq.client.apis.producer.SendReceipt;
+import org.apache.rocketmq.client.core.RocketMQClientTemplate;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class V5ProducerApplication implements CommandLineRunner {
+    @Resource
+    private RocketMQClientTemplate rocketMQClientTemplate;
+
+    @Value("${rocketmq.producer.topic}")
+    private String topic;
+
+    public static void main(String[] args) {
+        SpringApplication.run(V5ProducerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) {
+        SendReceipt sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(topic, "Hello V5");
+        System.out.println(sendReceipt);
+    }
+}
\ No newline at end of file
diff --git 
a/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/resources/application.properties
 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/resources/application.properties
new file mode 100644
index 0000000..4583144
--- /dev/null
+++ 
b/rocketmq-v5-client-spring-boot-samples/rocketmq-v5-client-producer-simple-demo/src/main/resources/application.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+rocketmq.producer.endpoints=localhost:8081
+rocketmq.producer.topic=demo-test
+#rocketmq.producer.access-key=
+#rocketmq.producer.secret-key=
\ No newline at end of file


Reply via email to