in rocketmq-jms/core/src/main/java/org/apache/rocketmq/jms/util/MessageConverter.java [147:181]
public static Message convert2RMQMessage(JmsBaseMessage jmsMsg) throws Exception {
Message rocketmqMsg = new MessageExt();
// 1. Transform message body
rocketmqMsg.setBody(MessageConverter.getContentFromJms(jmsMsg));
// 2. Transform topic and messageType
JmsBaseTopic destination = (JmsBaseTopic) jmsMsg.getHeaders().get(JmsBaseConstant.JMS_DESTINATION);
String topic = destination.getMessageTopic();
rocketmqMsg.setTopic(topic);
String messageType = destination.getMessageType();
Preconditions.checkState(!messageType.contains("||"),
"'||' can not be in the destination when sending a message");
rocketmqMsg.setTags(messageType);
// 3. Transform message properties
Properties properties = initRocketMQHeaders(jmsMsg, topic, messageType);
for (String name : properties.stringPropertyNames()) {
String value = properties.getProperty(name);
if (MessageConst.PROPERTY_KEYS.equals(name)) {
rocketmqMsg.setKeys(value);
} else if (MessageConst.PROPERTY_TAGS.equals(name)) {
rocketmqMsg.setTags(value);
} else if (MessageConst.PROPERTY_DELAY_TIME_LEVEL.equals(name)) {
rocketmqMsg.setDelayTimeLevel(Integer.parseInt(value));
} else if (MessageConst.PROPERTY_WAIT_STORE_MSG_OK.equals(name)) {
rocketmqMsg.setWaitStoreMsgOK(Boolean.parseBoolean(value));
} else if (MessageConst.PROPERTY_BUYER_ID.equals(name)) {
rocketmqMsg.setBuyerId(value);
} else {
rocketmqMsg.putUserProperty(name, value);
}
}
return rocketmqMsg;
}