Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #522] format code and Optimization description #522

Merged
merged 3 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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<String> replyGenericObject = rocketMQTemplate.sendAndReceive(genericRequestTopic, "request generic",
new TypeReference<ProductWithPayload<String>>() {
Expand All @@ -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<String>() {
@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<User>() {
@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> beans = this.applicationContext.getBeansWithAnnotation(RocketMQTransactionListener.class)
.entrySet().stream().filter(entry -> !ScopedProxyUtils.isScopedTarget(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
Expand Down