Search in sources :

Example 1 with MessageInfoImpl

use of org.apache.qpid.server.message.MessageInfoImpl in project qpid-broker-j by apache.

the class ReportRunner method convertMessage.

private static ReportableMessage convertMessage(QueueEntry entry) {
    final MessageInfoImpl messageInfo = new MessageInfoImpl(entry, true);
    ServerMessage message = entry.getMessage();
    byte[] content;
    try (QpidByteBuffer contentBuffer = message.getContent()) {
        content = new byte[contentBuffer.remaining()];
        contentBuffer.get(content);
    }
    return new ReportableMessage() {

        @Override
        public String getInitialRoutingAddress() {
            return messageInfo.getInitialRoutingAddress();
        }

        @Override
        public ReportableMessageHeader getMessageHeader() {
            return convertMessageHeader(messageInfo);
        }

        @Override
        public ByteBuffer getContent() {
            return ByteBuffer.wrap(content).asReadOnlyBuffer();
        }

        @Override
        public boolean isPersistent() {
            return messageInfo.isPersistent();
        }

        @Override
        public long getSize() {
            return messageInfo.getSize();
        }

        @Override
        public Date getExpiration() {
            return messageInfo.getExpirationTime();
        }

        @Override
        public long getMessageNumber() {
            return messageInfo.getId();
        }

        @Override
        public Date getArrivalTime() {
            return messageInfo.getArrivalTime();
        }
    };
}
Also used : MessageInfoImpl(org.apache.qpid.server.message.MessageInfoImpl) ServerMessage(org.apache.qpid.server.message.ServerMessage) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer)

Aggregations

QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)1 MessageInfoImpl (org.apache.qpid.server.message.MessageInfoImpl)1 ServerMessage (org.apache.qpid.server.message.ServerMessage)1