You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/05/30 07:00:22 UTC

[GitHub] [rocketmq-spring] wangxing-git opened a new issue #83: RocketMQUtil#addUserProperties can override headers from rocketmq(eg topic, tags, queue id...)

wangxing-git opened a new issue #83: RocketMQUtil#addUserProperties can override headers from rocketmq(eg topic,tags,queue id...)
URL: https://github.com/apache/rocketmq-spring/issues/83
 
 
   **BUG REPORT**
   
   1. Please describe the issue you observed:
   ```java
       private static void addUserProperties(Map<String, String> properties, MessageBuilder messageBuilder) {
           if (!CollectionUtils.isEmpty(properties)) {
               properties.forEach((key, val) -> {
                   if (!MessageConst.STRING_HASH_SET.contains(key) && !MessageHeaders.ID.equals(key)
                       && !MessageHeaders.TIMESTAMP.equals(key)) {
                       messageBuilder.setHeader(key, val);
                   }
               });
           }
       }
   ```
   Here is the judgment that can not override the properties from the `rocketmq`, but the actual key is not included in the `MessageConst.STRING_HASH_SET`, the real need to add the prefix `RocketMQHeaders.PREFIX`.(Maybe the previous judgment needs to be retained, but it is necessary to add another layer of judgment.)
   ```java
       public static String toRocketHeaderKey(String rawKey) {
           return RocketMQHeaders.PREFIX + rawKey;
       }
   ```
   refer [spring-cloud-incubator/spring-cloud-alibaba#684](https://github.com/spring-cloud-incubator/spring-cloud-alibaba/issues/684).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services