Search in sources :

Example 1 with Persister

use of org.apache.activemq.artemis.core.persistence.Persister in project activemq-artemis by apache.

the class EmbedMessageUtil method embedAsCoreMessage.

public static ICoreMessage embedAsCoreMessage(Message source) {
    if (source instanceof ICoreMessage) {
        return (ICoreMessage) source;
    } else {
        Persister persister = source.getPersister();
        CoreMessage message = new CoreMessage(source.getMessageID(), persister.getEncodeSize(source) + signature.length + CoreMessage.BODY_OFFSET).setType(Message.EMBEDDED_TYPE);
        ActiveMQBuffer buffer = message.getBodyBuffer();
        buffer.writeBytes(signature);
        persister.encode(buffer, source);
        return message;
    }
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) Persister(org.apache.activemq.artemis.core.persistence.Persister) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer)

Aggregations

ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)1 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)1 Persister (org.apache.activemq.artemis.core.persistence.Persister)1