diff --git a/rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java b/rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java index 3acd8a68..9fd3ac60 100644 --- a/rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java +++ b/rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java @@ -115,7 +115,8 @@ public void onException(Throwable var1) { }); // Send message with special tag - rocketMQTemplate.convertAndSend(msgExtTopic + ":tag0", "I'm from tag0"); // tag0 will not be consumer-selected + // tag0 will not be consumer-selected + rocketMQTemplate.convertAndSend(msgExtTopic + ":tag0", "I'm from tag0"); System.out.printf("syncSend topic %s tag %s %n", msgExtTopic, "tag0"); rocketMQTemplate.convertAndSend(msgExtTopic + ":tag1", "I'm from tag1"); System.out.printf("syncSend topic %s tag %s %n", msgExtTopic, "tag1"); @@ -144,6 +145,7 @@ public void onException(Throwable var1) { User requestUser = new User().setUserAge((byte) 9).setUserName("requestUserName"); User replyUser = rocketMQTemplate.sendAndReceive(objectRequestTopic, requestUser, User.class, "order-id"); System.out.printf("send %s and receive %s %n", requestUser, replyUser); + // Send request in sync mode with timeout and delayLevel parameter parameter and receive a reply of generic type. ProductWithPayload replyGenericObject = rocketMQTemplate.sendAndReceive(genericRequestTopic, "request generic", new TypeReference>() { @@ -152,21 +154,26 @@ public void onException(Throwable var1) { // Send request in async mode and receive a reply of String type. rocketMQTemplate.sendAndReceive(stringRequestTopic, "request string", new RocketMQLocalRequestCallback() { - @Override public void onSuccess(String message) { + @Override + public void onSuccess(String message) { System.out.printf("send %s and receive %s %n", "request string", message); } - @Override public void onException(Throwable e) { + @Override + public void onException(Throwable e) { e.printStackTrace(); } }); + // Send request in async mode and receive a reply of User type. rocketMQTemplate.sendAndReceive(objectRequestTopic, new User().setUserAge((byte) 9).setUserName("requestUserName"), new RocketMQLocalRequestCallback() { - @Override public void onSuccess(User message) { + @Override + public void onSuccess(User message) { System.out.printf("send user object and receive %s %n", message.toString()); } - @Override public void onException(Throwable e) { + @Override + public void onException(Throwable e) { e.printStackTrace(); } }, 5000); diff --git a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java index d91af62e..178285d7 100644 --- a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java +++ b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java @@ -124,7 +124,7 @@ private DefaultLitePullConsumer createConsumer(ExtRocketMQConsumerConfiguration String ak = resolvePlaceholders(annotation.accessKey(), consumerConfig.getAccessKey()); String sk = resolvePlaceholders(annotation.secretKey(), consumerConfig.getSecretKey()); int pullBatchSize = annotation.pullBatchSize(); - //if String is not is equal "true" TLS mode will represent the as default value false + //If the string is not equal to "true", the TLS mode will be represented as the default value of false boolean useTLS = new Boolean(environment.resolvePlaceholders(annotation.tlsEnable())); DefaultLitePullConsumer litePullConsumer = RocketMQUtil.createDefaultLitePullConsumer(nameServer, accessChannel, groupName, topicName, messageModel, selectorType, selectorExpression, ak, sk, pullBatchSize, useTLS); diff --git a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java index 99c08f20..2cf65913 100644 --- a/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java +++ b/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java @@ -44,11 +44,13 @@ public class RocketMQTransactionConfiguration implements ApplicationContextAware private ConfigurableApplicationContext applicationContext; - @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = (ConfigurableApplicationContext) applicationContext; } - @Override public void afterSingletonsInstantiated() { + @Override + public void afterSingletonsInstantiated() { Map beans = this.applicationContext.getBeansWithAnnotation(RocketMQTransactionListener.class) .entrySet().stream().filter(entry -> !ScopedProxyUtils.isScopedTarget(entry.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));