Search in sources :

Example 1 with MessageDurability

use of org.apache.qpid.server.store.MessageDurability in project qpid-broker-j by apache.

the class MessageStoreSerializer_v1 method deserializeMessageInstances.

private Record deserializeMessageInstances(final MessageStore store, final Map<UUID, UUID> queueIdMap, final Map<Long, StoredMessage<?>> messageMap, final Deserializer deserializer, Record nextRecord) throws IOException {
    while (nextRecord.getType() == RecordType.MESSAGE_INSTANCE) {
        MessageInstanceRecord messageInstanceRecord = (MessageInstanceRecord) nextRecord;
        final StoredMessage<?> storedMessage = messageMap.get(messageInstanceRecord.getMessageNumber());
        final UUID queueId = queueIdMap.get(messageInstanceRecord.getQueueId());
        if (storedMessage != null && queueId != null) {
            final Transaction txn = store.newTransaction();
            EnqueueableMessage msg = new EnqueueableMessage() {

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

                @Override
                public boolean isPersistent() {
                    return true;
                }

                @Override
                public StoredMessage getStoredMessage() {
                    return storedMessage;
                }
            };
            txn.enqueueMessage(new TransactionLogResource() {

                @Override
                public String getName() {
                    return queueId.toString();
                }

                @Override
                public UUID getId() {
                    return queueId;
                }

                @Override
                public MessageDurability getMessageDurability() {
                    return MessageDurability.DEFAULT;
                }
            }, msg);
            txn.commitTranAsync(null);
        }
        nextRecord = deserializer.readRecord();
    }
    return nextRecord;
}
Also used : MessageDurability(org.apache.qpid.server.store.MessageDurability) Transaction(org.apache.qpid.server.store.Transaction) EnqueueableMessage(org.apache.qpid.server.message.EnqueueableMessage) UUID(java.util.UUID) TransactionLogResource(org.apache.qpid.server.store.TransactionLogResource)

Aggregations

UUID (java.util.UUID)1 EnqueueableMessage (org.apache.qpid.server.message.EnqueueableMessage)1 MessageDurability (org.apache.qpid.server.store.MessageDurability)1 Transaction (org.apache.qpid.server.store.Transaction)1 TransactionLogResource (org.apache.qpid.server.store.TransactionLogResource)1