RongtongJin commented on code in PR #554:
URL: https://github.com/apache/rocketmq-spring/pull/554#discussion_r1212639249


##########
rocketmq-client-spring-boot-samples/README-CN.md:
##########
@@ -0,0 +1,684 @@
+<a name="qk9D5"></a>
+
+# Normal消息发送
+
+<a name="FRI7l"></a>
+
+### 修改application.properties
+
+**rocketmq.producer.topic:**用于给生产者设置topic名称(可选,但建议使用),生产者可以在消息发布之前**预取**topic路由。<br
 />**demo.rocketmq.normal-topic:**用户自定义消息发送的topic
+
+```properties
+rocketmq.producer.endpoints=127.0.0.1:8081
+rocketmq.producer.topic=normalTopic
+demo.rocketmq.normal-topic=normalTopic
+```
+
+> 注意:
+> 请将上述示例配置中的127.0.0.1:8081替换成真实RocketMQ的endpoints地址与端口
+
+<a name="BykT5"></a>
+
+### 编写代码
+
+通过@Value注解引入配置文件参数,指定自定义topic<br />通过@Resource注解引入RocketMQClientTemplate容器<br 
/>通过调用**RocketMQClientTemplate#syncSendNormalMessage**方法进行normal消息的发送(消息的参数类型可选:Object、String、byte[]、Message)
+
+```java
+@SpringBootApplication
+public class ClientProducerApplication implements CommandLineRunner {
+
+    private static final Logger log = 
LoggerFactory.getLogger(ClientProducerApplication.class);
+
+    @Value("${demo.rocketmq.normal-topic}")
+    private String normalTopic;
+    
+    @Resource
+    private RocketMQClientTemplate rocketMQClientTemplate;
+    
+    public static void main(String[] args) {
+        SpringApplication.run(ClientProducerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) throws ClientException {
+        testSendNormalMessage();
+    }
+
+    //Test sending normal message
+    void testSendNormalMessage() {
+        SendReceipt sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, new UserMessage()
+                .setId(1).setUserName("name").setUserAge((byte) 3));
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, "normal message");
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, "byte 
message".getBytes(StandardCharsets.UTF_8));
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, MessageBuilder.
+                withPayload("test message".getBytes()).build());
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+    }
+
+    @Data
+    @AllArgsConstructor
+    public class UserMeaasge implements Serializable {
+        private int id;
+        private String userName;
+        private Byte userAge;
+    }
+
+}
+```
+
+<a name="Rl1D7"></a>
+
+# FIFO消息发送
+
+<a name="XnRuP"></a>
+
+### 修改application.properties
+
+**rocketmq.producer.topic:**用于给生产者设置topic名称(可选,但建议使用),生产者可以在消息发布之前**预取**topic路由。<br
 />**demo.rocketmq.fifo-topic:**用户自定义消息发送的topic<br 
/>**demo.rocketmq.message-group=group1:**顺序消息的顺序关系通过消息组(MessageGroup)判定和识别,发送顺序消息时需要为每条消息设置归属的消息组,相同消息组的多条消息之间遵循先进先出的顺序关系,不同消息组、无消息组的消息之间不涉及顺序性。
+
+```properties
+rocketmq.producer.endpoints=127.0.0.1:8081
+rocketmq.producer.topic=fifoTopic
+demo.rocketmq.fifo-topic=fifoTopic
+demo.rocketmq.message-group=group1
+```
+
+> 注意:
+> 请将上述示例配置中的127.0.0.1:8081替换成真实RocketMQ的endpoints地址与端口
+
+<a name="QSR1T"></a>
+
+### 编写代码
+
+通过@Value注解引入配置文件参数,指定自定义topic<br />通过@Resource注解引入RocketMQClientTemplate容器<br 
/>通过调用**RocketMQClientTemplate#syncSendNormalMessage**方法进行fifo消息的发送(参数类型可选:Object、String、byte[]、Message)<br
 />发送fifo消息时需要设置参数:消费者组(MessageGroup)
+
+```java
+@SpringBootApplication
+public class ClientProducerApplication implements CommandLineRunner {
+
+    private static final Logger log = 
LoggerFactory.getLogger(ClientProducerApplication.class);
+
+    @Value("${demo.rocketmq.fifo-topic}")
+    private String fifoTopic;
+    
+    @Value("${demo.rocketmq.message-group}")
+    private String messageGroup;
+
+    @Resource
+    private RocketMQClientTemplate rocketMQClientTemplate;
+    
+    public static void main(String[] args) {
+        SpringApplication.run(ClientProducerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) throws ClientException {
+        testSendFIFOMessage();
+    }
+
+    //Test sending fifo message
+    void testSendFIFOMessage() {
+        SendReceipt sendReceipt = 
rocketMQClientTemplate.syncSendFifoMessage(fifoTopic, new UserMessage()
+                .setId(1).setUserName("name").setUserAge((byte) 3), 
messageGroup);
+        System.out.printf("fifoSend to topic %s sendReceipt=%s %n", fifoTopic, 
sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendFifoMessage(fifoTopic, 
MessageBuilder.
+                withPayload("test message".getBytes()).build(), messageGroup);
+        System.out.printf("fifoSend to topic %s sendReceipt=%s %n", fifoTopic, 
sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendFifoMessage(fifoTopic, 
"fifo message", messageGroup);
+        System.out.printf("fifoSend to topic %s sendReceipt=%s %n", fifoTopic, 
sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendFifoMessage(fifoTopic, 
"byte message".getBytes(StandardCharsets.UTF_8), messageGroup);
+        System.out.printf("fifoSend to topic %s sendReceipt=%s %n", fifoTopic, 
sendReceipt);
+    }
+
+    @Data
+    @AllArgsConstructor
+    public class UserMeaasge implements Serializable {
+        private int id;
+        private String userName;
+        private Byte userAge;
+    }
+    
+}
+```
+
+<a name="hn3Wn"></a>
+
+# Delay消息发送
+
+<a name="GvUOb"></a>
+
+### 修改application.properties
+
+**rocketmq.producer.topic:**用于给生产者设置topic名称(可选,但建议使用),生产者可以在消息发布之前**预取**topic路由。<br
 />**demo.rocketmq.delay-topic:**用户自定义消息发送的topic
+
+```java
+rocketmq.producer.endpoints=127.0.0.1:8081
+rocketmq.producer.topic=delayTopic
+demo.rocketmq.fifo-topic=delayTopic
+```
+
+> 注意:
+> 请将上述示例配置中的127.0.0.1:8081替换成真实RocketMQ的endpoints地址与端口
+
+<a name="QY1y9"></a>
+
+### 编写代码
+
+通过@Value注解引入配置文件参数,指定自定义topic<br />通过@Resource注解引入RocketMQClientTemplate容器<br 
/>通过调用**RocketMQClientTemplate#syncSendNormalMessage**方法进行delay消息的发送(消息的参数类型可选:Object、String、byte[]、Message)<br
 />发送delay消息时需要指定延迟时间:DeliveryTimestamp
+
+```java
+@SpringBootApplication
+public class ClientProducerApplication implements CommandLineRunner {
+
+    private static final Logger log = 
LoggerFactory.getLogger(ClientProducerApplication.class);
+
+    @Value("${demo.rocketmq.delay-topic}")
+    private String delayTopic;
+    
+    @Resource
+    private RocketMQClientTemplate rocketMQClientTemplate;
+    public static void main(String[] args) {
+        SpringApplication.run(ClientProducerApplication.class, args);
+    }
+
+    @Override
+    public void run(String... args) throws ClientException {
+        testSendDelayMessage();
+    }
+
+    //Test sending delay message
+    void testSendDelayMessage() {
+        
+        SendReceipt sendReceipt = 
rocketMQClientTemplate.syncSendDelayMessage(delayTopic, new UserMessage()
+                .setId(1).setUserName("name").setUserAge((byte) 3), 
Duration.ofSeconds(10));
+        System.out.printf("delaySend to topic %s sendReceipt=%s %n", 
delayTopic, sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendDelayMessage(delayTopic, 
MessageBuilder.
+                withPayload("test message".getBytes()).build(), 
Duration.ofSeconds(20));
+        System.out.printf("delaySend to topic %s sendReceipt=%s %n", 
delayTopic, sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendDelayMessage(delayTopic, 
"this is my message",
+                Duration.ofSeconds(30));
+        System.out.printf("delaySend to topic %s sendReceipt=%s %n", 
delayTopic, sendReceipt);
+
+        sendReceipt = rocketMQClientTemplate.syncSendDelayMessage(delayTopic, 
"byte messages".getBytes(StandardCharsets.UTF_8),
+                Duration.ofSeconds(40));
+        System.out.printf("delaySend to topic %s sendReceipt=%s %n", 
delayTopic, sendReceipt);
+    }
+
+    @Data
+    @AllArgsConstructor
+    public class UserMeaasge implements Serializable {
+        int id;
+        private String userName;
+        private Byte userAge;
+    }
+
+}
+```
+
+<a name="znYRu"></a>
+
+# 事务消息发送
+
+<a name="PXCrp"></a>
+
+### 修改application.properties
+
+**rocketmq.producer.topic:**用于给生产者设置topic名称(可选,但建议使用),生产者可以在消息发布之前**预取**topic路由。<br
 />**demo.rocketmq.delay-topic:**用户自定义消息发送的topic
+
+```java
+rocketmq.producer.endpoints=127.0.0.1:8081
+rocketmq.producer.topic=transTopic
+demo.rocketmq.trans-topic=transTopic
+```
+
+> 注意:
+> 请将上述示例配置中的127.0.0.1:8081替换成真实RocketMQ的endpoints地址与端口
+
+<a name="LAdLL"></a>
+
+### 编写代码
+
+通过@Value注解引入配置文件参数,指定自定义topic<br />通过@Resource注解引入RocketMQClientTemplate容器<br 
/>通过调用**RocketMQClientTemplate#sendMessageInTransaction**方法进行事务消息的发送(消息的参数类型可选:Object、String、byte[]、Message)。<br
 
/>发送成功后会收到Pair类型的返回值,其左值代表返回值SendReceipt;右值代表Transaction,可以让用户根据本地事务处理结果的业务逻辑来决定commit还是rollback。<br
 
/>使用注解@RocketMQTransactionListener标记一个自定义类,该类必须实现RocketMQTransactionChecker接口,并重写TransactionResolution
 check(MessageView messageView)方法。
+
+```java
+    void testSendNormalMessage() {
+        SendReceipt sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, new UserMessage()
+                .setId(1).setUserName("name").setUserAge((byte) 3));
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, "normal message");
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, "byte 
message".getBytes(StandardCharsets.UTF_8));
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+
+        sendReceipt = 
rocketMQClientTemplate.syncSendNormalMessage(normalTopic, MessageBuilder.
+                withPayload("test message".getBytes()).build());
+        System.out.printf("normalSend to topic %s sendReceipt=%s %n", 
normalTopic, sendReceipt);
+    }

Review Comment:
   This part of the example is unnecessary.



##########
rocketmq-client-spring-boot-samples/README-CN.md:
##########
@@ -0,0 +1,684 @@
+<a name="qk9D5"></a>
+
+# Normal消息发送
+
+<a name="FRI7l"></a>
+
+### 修改application.properties
+
+**rocketmq.producer.topic:**用于给生产者设置topic名称(可选,但建议使用),生产者可以在消息发布之前**预取**topic路由。<br
 />**demo.rocketmq.normal-topic:**用户自定义消息发送的topic

Review Comment:
   
![image](https://github.com/apache/rocketmq-spring/assets/21963954/b48f09a6-ccf7-40a9-8a1a-d95d723b4171)
   这里的加粗似乎有点问题。



##########
pom.xml:
##########
@@ -215,6 +215,9 @@
         <module>rocketmq-spring-boot-parent</module>
         <module>rocketmq-spring-boot</module>
         <module>rocketmq-spring-boot-starter</module>
+        <module>rocketmq-client-spring-boot</module>
+        <module>rocketmq-client-spring-boot-parent</module>
+        <module>rocketmq-client-spring-boot-starter</module>

Review Comment:
   > Is there a possibility that we don't emphasize gRPC, since the artifact id 
of 5.x SDK doesn't contain the keyword "gRPC" either?
   
   Or rocketmq-v5-client-spring-boot?



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