@Test public void testConvertToSpringMessage() { org.apache.rocketmq.common.message.MessageExt rocketMsg = new org.apache.rocketmq.common.message.MessageExt(); rocketMsg.setTopic("test"); rocketMsg.setBody("test".getBytes()); rocketMsg.setTags("tagA"); rocketMsg.setKeys("key1"); Message message = RocketMQUtil.convertToSpringMessage(rocketMsg); assertEquals("test", message.getHeaders().get(toRocketHeaderKey(RocketMQHeaders.TOPIC))); assertEquals("tagA", message.getHeaders().get(toRocketHeaderKey(RocketMQHeaders.TAGS))); assertEquals("key1", message.getHeaders().get(toRocketHeaderKey(RocketMQHeaders.KEYS))); }
public static org.springframework.messaging.Message convertToSpringMessage( org.apache.rocketmq.common.message.MessageExt message) { MessageBuilder messageBuilder = MessageBuilder.withPayload(message.getBody()). setHeader(toRocketHeaderKey(RocketMQHeaders.KEYS), message.getKeys()). setHeader(toRocketHeaderKey(RocketMQHeaders.TAGS), message.getTags()). setHeader(toRocketHeaderKey(RocketMQHeaders.TOPIC), message.getTopic()). setHeader(toRocketHeaderKey(RocketMQHeaders.MESSAGE_ID), message.getMsgId()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_TIMESTAMP), message.getBornTimestamp()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_HOST), message.getBornHostString()). setHeader(toRocketHeaderKey(RocketMQHeaders.FLAG), message.getFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.QUEUE_ID), message.getQueueId()). setHeader(toRocketHeaderKey(RocketMQHeaders.SYS_FLAG), message.getSysFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.TRANSACTION_ID), message.getTransactionId()); addUserProperties(message.getProperties(), messageBuilder); return messageBuilder.build(); }
RocketMQUtil { public static org.springframework.messaging.Message convertToSpringMessage( org.apache.rocketmq.common.message.MessageExt message) { MessageBuilder messageBuilder = MessageBuilder.withPayload(message.getBody()). setHeader(toRocketHeaderKey(RocketMQHeaders.KEYS), message.getKeys()). setHeader(toRocketHeaderKey(RocketMQHeaders.TAGS), message.getTags()). setHeader(toRocketHeaderKey(RocketMQHeaders.TOPIC), message.getTopic()). setHeader(toRocketHeaderKey(RocketMQHeaders.MESSAGE_ID), message.getMsgId()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_TIMESTAMP), message.getBornTimestamp()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_HOST), message.getBornHostString()). setHeader(toRocketHeaderKey(RocketMQHeaders.FLAG), message.getFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.QUEUE_ID), message.getQueueId()). setHeader(toRocketHeaderKey(RocketMQHeaders.SYS_FLAG), message.getSysFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.TRANSACTION_ID), message.getTransactionId()); addUserProperties(message.getProperties(), messageBuilder); return messageBuilder.build(); } }
RocketMQUtil { public static org.springframework.messaging.Message convertToSpringMessage( org.apache.rocketmq.common.message.MessageExt message) { MessageBuilder messageBuilder = MessageBuilder.withPayload(message.getBody()). setHeader(toRocketHeaderKey(RocketMQHeaders.KEYS), message.getKeys()). setHeader(toRocketHeaderKey(RocketMQHeaders.TAGS), message.getTags()). setHeader(toRocketHeaderKey(RocketMQHeaders.TOPIC), message.getTopic()). setHeader(toRocketHeaderKey(RocketMQHeaders.MESSAGE_ID), message.getMsgId()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_TIMESTAMP), message.getBornTimestamp()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_HOST), message.getBornHostString()). setHeader(toRocketHeaderKey(RocketMQHeaders.FLAG), message.getFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.QUEUE_ID), message.getQueueId()). setHeader(toRocketHeaderKey(RocketMQHeaders.SYS_FLAG), message.getSysFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.TRANSACTION_ID), message.getTransactionId()); addUserProperties(message.getProperties(), messageBuilder); return messageBuilder.build(); }  }
RocketMQUtil { public static org.springframework.messaging.Message convertToSpringMessage( org.apache.rocketmq.common.message.MessageExt message) { MessageBuilder messageBuilder = MessageBuilder.withPayload(message.getBody()). setHeader(toRocketHeaderKey(RocketMQHeaders.KEYS), message.getKeys()). setHeader(toRocketHeaderKey(RocketMQHeaders.TAGS), message.getTags()). setHeader(toRocketHeaderKey(RocketMQHeaders.TOPIC), message.getTopic()). setHeader(toRocketHeaderKey(RocketMQHeaders.MESSAGE_ID), message.getMsgId()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_TIMESTAMP), message.getBornTimestamp()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_HOST), message.getBornHostString()). setHeader(toRocketHeaderKey(RocketMQHeaders.FLAG), message.getFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.QUEUE_ID), message.getQueueId()). setHeader(toRocketHeaderKey(RocketMQHeaders.SYS_FLAG), message.getSysFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.TRANSACTION_ID), message.getTransactionId()); addUserProperties(message.getProperties(), messageBuilder); return messageBuilder.build(); }  static TransactionListener convert(RocketMQLocalTransactionListener listener); static MessagingException convert(MQClientException e); static org.springframework.messaging.Message convertToSpringMessage(
        org.apache.rocketmq.common.message.MessageExt message); static String toRocketHeaderKey(String rawKey); static org.springframework.messaging.Message convertToSpringMessage(
        org.apache.rocketmq.common.message.Message message); @Deprecated static org.apache.rocketmq.common.message.Message convertToRocketMessage(
        ObjectMapper objectMapper, String charset,
        String destination, org.springframework.messaging.Message message); static org.apache.rocketmq.common.message.Message convertToRocketMessage(
        MessageConverter messageConverter, String charset,
        String destination, org.springframework.messaging.Message<?> message); static RPCHook getRPCHookByAkSk(Environment env, String accessKeyOrExpr, String secretKeyOrExpr); static DefaultMQProducer createDefaultMQProducer(String groupName, String ak, String sk,
        boolean isEnableMsgTrace, String customizedTraceTopic); }
RocketMQUtil { public static org.springframework.messaging.Message convertToSpringMessage( org.apache.rocketmq.common.message.MessageExt message) { MessageBuilder messageBuilder = MessageBuilder.withPayload(message.getBody()). setHeader(toRocketHeaderKey(RocketMQHeaders.KEYS), message.getKeys()). setHeader(toRocketHeaderKey(RocketMQHeaders.TAGS), message.getTags()). setHeader(toRocketHeaderKey(RocketMQHeaders.TOPIC), message.getTopic()). setHeader(toRocketHeaderKey(RocketMQHeaders.MESSAGE_ID), message.getMsgId()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_TIMESTAMP), message.getBornTimestamp()). setHeader(toRocketHeaderKey(RocketMQHeaders.BORN_HOST), message.getBornHostString()). setHeader(toRocketHeaderKey(RocketMQHeaders.FLAG), message.getFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.QUEUE_ID), message.getQueueId()). setHeader(toRocketHeaderKey(RocketMQHeaders.SYS_FLAG), message.getSysFlag()). setHeader(toRocketHeaderKey(RocketMQHeaders.TRANSACTION_ID), message.getTransactionId()); addUserProperties(message.getProperties(), messageBuilder); return messageBuilder.build(); }  static TransactionListener convert(RocketMQLocalTransactionListener listener); static MessagingException convert(MQClientException e); static org.springframework.messaging.Message convertToSpringMessage(
        org.apache.rocketmq.common.message.MessageExt message); static String toRocketHeaderKey(String rawKey); static org.springframework.messaging.Message convertToSpringMessage(
        org.apache.rocketmq.common.message.Message message); @Deprecated static org.apache.rocketmq.common.message.Message convertToRocketMessage(
        ObjectMapper objectMapper, String charset,
        String destination, org.springframework.messaging.Message message); static org.apache.rocketmq.common.message.Message convertToRocketMessage(
        MessageConverter messageConverter, String charset,
        String destination, org.springframework.messaging.Message<?> message); static RPCHook getRPCHookByAkSk(Environment env, String accessKeyOrExpr, String secretKeyOrExpr); static DefaultMQProducer createDefaultMQProducer(String groupName, String ak, String sk,
        boolean isEnableMsgTrace, String customizedTraceTopic);  }