RongtongJin commented on a change in pull request #209: [ISSUE #208]support
request/reply model in rocketmq-spring
URL: https://github.com/apache/rocketmq-spring/pull/209#discussion_r364544448
##########
File path:
rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java
##########
@@ -116,6 +128,53 @@ public void onException(Throwable var1) {
// Send transactional messages using extRocketMQTemplate
testExtRocketMQTemplateTransaction();
+
+ // send request in sync mode and receive a reply of String type.
+ String replyString =
rocketMQTemplate.sendAndReceive(stringRequestTopic, "request string",
String.class);
+ System.out.printf("send %s and receive %s %n", "request string",
replyString);
+
+ // send request in sync mode with timeout parameter and receive a
reply of byte[] type.
+ byte[] replyBytes = rocketMQTemplate.sendAndReceive(bytesRequestTopic,
new Message<String>() {
Review comment:
It would be better to use `MessageBuilder.withPayload("request
byte[]").build()`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services