From 6d9fe2d5cb4debfcb55a50004e27a857a87fec0d Mon Sep 17 00:00:00 2001 From: misselvexu Date: Wed, 25 May 2022 15:55:50 +0800 Subject: [PATCH 1/2] Upgrade rocketmq 4.9.3 . --- pom.xml | 2 +- .../pom.xml | 19 +----------------- .../RocketMQBinderAutoConfiguration.java | 20 ++++++++++++------- .../RocketMQMessageConverterSupport.java | 6 +++--- 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index a56944432..0b711745d 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ 2.0.4 - 4.6.1 + 4.9.3 3.7.0 diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/pom.xml b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/pom.xml index ca5c22391..e471d9248 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/pom.xml +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/pom.xml @@ -24,24 +24,6 @@ true - - org.springframework.boot - spring-boot - true - - - - org.springframework.boot - spring-boot-autoconfigure - true - - - - org.springframework.boot - spring-boot-actuator - true - - org.springframework.boot spring-boot-actuator-autoconfigure @@ -56,6 +38,7 @@ org.apache.rocketmq rocketmq-acl + org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index b9b85db24..8410b7d86 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -24,6 +24,7 @@ import com.alibaba.cloud.stream.binder.rocketmq.provisioning.RocketMQTopicProvis import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; +import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -46,13 +47,6 @@ public class RocketMQBinderAutoConfiguration { @Autowired private RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties; - @Bean - @ConditionalOnEnabledHealthIndicator("rocketmq") - @ConditionalOnClass(name = "org.springframework.boot.actuate.health.HealthIndicator") - public RocketMQBinderHealthIndicator rocketMQBinderHealthIndicator() { - return new RocketMQBinderHealthIndicator(); - } - @Bean public RocketMQTopicProvisioner rocketMQTopicProvisioner() { return new RocketMQTopicProvisioner(); @@ -65,4 +59,16 @@ public class RocketMQBinderAutoConfiguration { extendedBindingProperties, provisioningProvider); } + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(HealthIndicator.class) + @ConditionalOnEnabledHealthIndicator("rocketmq") + static class KafkaBinderHealthIndicatorConfiguration { + + @Bean + public RocketMQBinderHealthIndicator rocketMQBinderHealthIndicator() { + return new RocketMQBinderHealthIndicator(); + } + + } + } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/support/RocketMQMessageConverterSupport.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/support/RocketMQMessageConverterSupport.java index 3615cd4e8..ace7a901d 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/support/RocketMQMessageConverterSupport.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/support/RocketMQMessageConverterSupport.java @@ -33,7 +33,7 @@ import org.springframework.messaging.converter.CompositeMessageConverter; import org.springframework.messaging.support.MessageBuilder; import org.springframework.util.CollectionUtils; import org.springframework.util.MimeTypeUtils; -import org.springframework.util.StringUtils; +import org.springframework.util.ObjectUtils; /** * @author zkzlx @@ -138,13 +138,13 @@ public final class RocketMQMessageConverterSupport { if (Objects.nonNull(headers) && !headers.isEmpty()) { Object tag = headers.getOrDefault(Headers.TAGS, headers.get(toRocketHeaderKey(Headers.TAGS))); - if (!StringUtils.isEmpty(tag)) { + if (!ObjectUtils.isEmpty(tag)) { rocketMsg.setTags(String.valueOf(tag)); } Object keys = headers.getOrDefault(Headers.KEYS, headers.get(toRocketHeaderKey(Headers.KEYS))); - if (!StringUtils.isEmpty(keys)) { + if (!ObjectUtils.isEmpty(keys)) { rocketMsg.setKeys(keys.toString()); } Object flagObj = headers.getOrDefault(Headers.FLAG, From 84a43fe1950838a0fa0380dcf5888b1edaec9843 Mon Sep 17 00:00:00 2001 From: misselvexu Date: Wed, 25 May 2022 19:52:55 +0800 Subject: [PATCH 2/2] Rename HealthIndicatorConfiguration . --- .../autoconfigurate/RocketMQBinderAutoConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index 8410b7d86..b6b1ba860 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -62,7 +62,7 @@ public class RocketMQBinderAutoConfiguration { @Configuration(proxyBeanMethods = false) @ConditionalOnClass(HealthIndicator.class) @ConditionalOnEnabledHealthIndicator("rocketmq") - static class KafkaBinderHealthIndicatorConfiguration { + static class RocketMQBinderHealthIndicatorConfiguration { @Bean public RocketMQBinderHealthIndicator rocketMQBinderHealthIndicator() {