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/12/09 08:14:26 UTC

[GitHub] [rocketmq-spring] lexiLiu opened a new issue #195: tags is invalid

lexiLiu opened a new issue #195: tags is invalid
URL: https://github.com/apache/rocketmq-spring/issues/195
 
 
   代码中设置了TAGS,但是发消息时TAGS是无效的。
   `Message<Order> message = MessageBuilder
                   .withPayload(order)
                   // keys
                   .setHeader(MessageConst.PROPERTY_KEYS, id))
                   // tags
                   .setHeader(MessageConst.PROPERTY_TAGS, MqConfig.EventTagEnum.TAG_ORDER_CREATE.tag)
                   .build();
           rocketMQTemplate.asyncSend(MqConfig.orderEvent, message, new SendCallback() {});`
   
   我跟踪了源码,发现`RocketMQUtil.convertToSpringMessage`中有一段代码过滤了tags,如下:
   `headers.entrySet().stream()
                   .filter(entry -> !Objects.equals(entry.getKey(), "FLAG")
                       && !Objects.equals(entry.getKey(), "WAIT_STORE_MSG_OK")) // exclude "FLAG", "WAIT_STORE_MSG_OK"
                   .forEach(entry -> {
                       if (!MessageConst.STRING_HASH_SET.contains(entry.getKey())) {
                           rocketMsg.putUserProperty(entry.getKey(), String.valueOf(entry.getValue()));
                       }
                   });`
   `(!MessageConst.STRING_HASH_SET.contains(entry.getKey()))`,这个判断没有理解,我猜想是不是这个判断多了 `!`,过滤我设置的TAGS

----------------------------------------------------------------
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