ldcsaa opened a new issue, #674:
URL: https://github.com/apache/rocketmq-spring/issues/674

   1. 
[ExtTemplateResetConfiguration.java](https://github.com/apache/rocketmq-spring/blob/master/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtTemplateResetConfiguration.java)
   
   ```java
       private void validate(ExtProducerResetConfiguration annotation,
                             GenericApplicationContext 
genericApplicationContext) {
           if (genericApplicationContext.isBeanNameInUse(annotation.value())) {
               // ! BUG !
               // String.format 应该用 '%' 而不是 '{}' 作为占位符
               throw new BeanDefinitionValidationException(String.format("Bean 
{} has been used in Spring Application Context, " +
                               "please check the @ExtTemplateConfiguration",
                       annotation.value()));
           }
       }
   ```
   
   2. 
[RocketMQUtil.java](https://github.com/apache/rocketmq-spring/blob/master/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQUtil.java)
   
   ```java
       public static org.apache.rocketmq.client.apis.message.Message 
getAndWrapMessage(
               String destination, MessageHeaders headers, byte[] payloads, 
Duration messageDelayTime, String messageGroup) {
           if (payloads == null || payloads.length < 1) {
               return null;
           }
           if (destination == null || destination.length() < 1) {
               return null;
           }
           String[] tempArr = destination.split(":", 2);
           final ClientServiceProvider provider = 
ClientServiceProvider.loadService();
           org.apache.rocketmq.client.apis.message.MessageBuilder 
messageBuilder = null;
           // resolve header
           if (Objects.nonNull(headers) && !headers.isEmpty()) {
               Object keys = headers.get(RocketMQHeaders.KEYS);
               if (ObjectUtils.isEmpty(keys)) {
                   keys = headers.get(toRocketHeaderKey(RocketMQHeaders.KEYS));
               }
               messageBuilder = provider.newMessageBuilder()
                       .setTopic(tempArr[0]);
               if (tempArr.length > 1) {
                   messageBuilder.setTag(tempArr[1]);
               }
               if (StringUtils.hasLength(messageGroup)) {
                   messageBuilder.setMessageGroup(messageGroup);
               }
               if (!ObjectUtils.isEmpty(keys)) {
                   // ! BUG !
                   // 这里调用 keys.toString() 有问题:意味着无论 keys 
参数是逗号分隔的字符串,或者是字符串数组,传入 messageBuilder.setKeys() 后都变为单个字符串。这似乎与 
messageBuilder.setKeys() 的设置初衷不一致。
                   messageBuilder.setKeys(keys.toString());
               }
               if (Objects.nonNull(messageDelayTime)) {
                   
messageBuilder.setDeliveryTimestamp(System.currentTimeMillis() + 
messageDelayTime.toMillis());
               }
               messageBuilder.setBody(payloads);
               org.apache.rocketmq.client.apis.message.MessageBuilder builder = 
messageBuilder;
               headers.forEach((key, value) -> builder.addProperty(key, 
String.valueOf(value)));
           }
           return messageBuilder.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.

To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to