Skip to content

Commit f312095

Browse files
123monkeyliuyazhou
andauthored
[ISSUE #522] format code and Optimization description (#522)
* format code * Optimization description * format code --------- Co-authored-by: liuyazhou <liuyzc@yonyou.com>
1 parent 8d8f3a1 commit f312095

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ public void onException(Throwable var1) {
115115
});
116116

117117
// Send message with special tag
118-
rocketMQTemplate.convertAndSend(msgExtTopic + ":tag0", "I'm from tag0"); // tag0 will not be consumer-selected
118+
// tag0 will not be consumer-selected
119+
rocketMQTemplate.convertAndSend(msgExtTopic + ":tag0", "I'm from tag0");
119120
System.out.printf("syncSend topic %s tag %s %n", msgExtTopic, "tag0");
120121
rocketMQTemplate.convertAndSend(msgExtTopic + ":tag1", "I'm from tag1");
121122
System.out.printf("syncSend topic %s tag %s %n", msgExtTopic, "tag1");
@@ -144,6 +145,7 @@ public void onException(Throwable var1) {
144145
User requestUser = new User().setUserAge((byte) 9).setUserName("requestUserName");
145146
User replyUser = rocketMQTemplate.sendAndReceive(objectRequestTopic, requestUser, User.class, "order-id");
146147
System.out.printf("send %s and receive %s %n", requestUser, replyUser);
148+
147149
// Send request in sync mode with timeout and delayLevel parameter parameter and receive a reply of generic type.
148150
ProductWithPayload<String> replyGenericObject = rocketMQTemplate.sendAndReceive(genericRequestTopic, "request generic",
149151
new TypeReference<ProductWithPayload<String>>() {
@@ -152,21 +154,26 @@ public void onException(Throwable var1) {
152154

153155
// Send request in async mode and receive a reply of String type.
154156
rocketMQTemplate.sendAndReceive(stringRequestTopic, "request string", new RocketMQLocalRequestCallback<String>() {
155-
@Override public void onSuccess(String message) {
157+
@Override
158+
public void onSuccess(String message) {
156159
System.out.printf("send %s and receive %s %n", "request string", message);
157160
}
158161

159-
@Override public void onException(Throwable e) {
162+
@Override
163+
public void onException(Throwable e) {
160164
e.printStackTrace();
161165
}
162166
});
167+
163168
// Send request in async mode and receive a reply of User type.
164169
rocketMQTemplate.sendAndReceive(objectRequestTopic, new User().setUserAge((byte) 9).setUserName("requestUserName"), new RocketMQLocalRequestCallback<User>() {
165-
@Override public void onSuccess(User message) {
170+
@Override
171+
public void onSuccess(User message) {
166172
System.out.printf("send user object and receive %s %n", message.toString());
167173
}
168174

169-
@Override public void onException(Throwable e) {
175+
@Override
176+
public void onException(Throwable e) {
170177
e.printStackTrace();
171178
}
172179
}, 5000);

rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private DefaultLitePullConsumer createConsumer(ExtRocketMQConsumerConfiguration
124124
String ak = resolvePlaceholders(annotation.accessKey(), consumerConfig.getAccessKey());
125125
String sk = resolvePlaceholders(annotation.secretKey(), consumerConfig.getSecretKey());
126126
int pullBatchSize = annotation.pullBatchSize();
127-
//if String is not is equal "true" TLS mode will represent the as default value false
127+
//If the string is not equal to "true", the TLS mode will be represented as the default value of false
128128
boolean useTLS = new Boolean(environment.resolvePlaceholders(annotation.tlsEnable()));
129129
DefaultLitePullConsumer litePullConsumer = RocketMQUtil.createDefaultLitePullConsumer(nameServer, accessChannel,
130130
groupName, topicName, messageModel, selectorType, selectorExpression, ak, sk, pullBatchSize, useTLS);

rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/RocketMQTransactionConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ public class RocketMQTransactionConfiguration implements ApplicationContextAware
4444

4545
private ConfigurableApplicationContext applicationContext;
4646

47-
@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
47+
@Override
48+
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
4849
this.applicationContext = (ConfigurableApplicationContext) applicationContext;
4950
}
5051

51-
@Override public void afterSingletonsInstantiated() {
52+
@Override
53+
public void afterSingletonsInstantiated() {
5254
Map<String, Object> beans = this.applicationContext.getBeansWithAnnotation(RocketMQTransactionListener.class)
5355
.entrySet().stream().filter(entry -> !ScopedProxyUtils.isScopedTarget(entry.getKey()))
5456
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

0 commit comments

Comments
 (0)