cj-8480 commented on issue #294:
URL: https://github.com/apache/rocketmq-spring/issues/294#issuecomment-688018715


   @RongtongJin 
   直接补充前缀应该会影响到其他正在使用的。
   我在自己程序里面增加下面这个方法暂时先解决了。
   <pre><code>
   private Message<?> 
convertToSpringMessage(org.apache.rocketmq.common.message.Message message) {
        Message<?> convertToSpringMessage = 
RocketMQUtil.convertToSpringMessage(message);
        // 转换Message补充KEYS参数,解决KEYS空问题
        // --- start ---
        Message<?> targetMessage = null;
        if (convertToSpringMessage instanceof GenericMessage) {
                GenericMessage<?> sourceMessage = (GenericMessage<?>) 
convertToSpringMessage;
                Map<String, Object> headers = new HashMap<>();
                headers.putAll(sourceMessage.getHeaders());
                headers.put(RocketMQHeaders.KEYS, message.getKeys());
                targetMessage = new 
GenericMessage<>(sourceMessage.getPayload(), headers);
        }
        // --- end ---
   
        return targetMessage;
   }
   </code></pre>


----------------------------------------------------------------
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:
[email protected]


Reply via email to