All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enodeframework.rocketmq.message.RocketMQTool Maven / Gradle / Ivy

There is a newer version: 1.1.10
Show newest version
package org.enodeframework.rocketmq.message;

import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;
import org.enodeframework.common.utilities.BitConverter;
import org.enodeframework.queue.QueueMessage;

/**
 * @author [email protected]
 */
public class RocketMQTool {
    public static QueueMessage covertToQueueMessage(MessageExt messageExt) {
        QueueMessage queueMessage = new QueueMessage();
        queueMessage.setBody(BitConverter.toString(messageExt.getBody()));
        queueMessage.setTopic(messageExt.getTopic());
        queueMessage.setTag(messageExt.getTags());
        queueMessage.setKey(messageExt.getKeys());
        return queueMessage;
    }

    public static Message covertToProducerRecord(QueueMessage queueMessage) {
        return new Message(queueMessage.getTopic(), queueMessage.getTag(), queueMessage.getKey(), BitConverter.getBytes(queueMessage.getBody()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy