use of org.apache.qpid.server.store.TransactionLogResource in project qpid-broker-j by apache.
the class ConsumerTarget_0_10 method sendToDLQOrDiscard.
private void sendToDLQOrDiscard(final MessageInstanceConsumer consumer, MessageInstance entry) {
final ServerMessage msg = entry.getMessage();
int requeues = 0;
if (entry.makeAcquisitionUnstealable(consumer)) {
requeues = entry.routeToAlternate(new Action<MessageInstance>() {
@Override
public void performAction(final MessageInstance requeueEntry) {
getEventLogger().message(ChannelMessages.DEADLETTERMSG(msg.getMessageNumber(), requeueEntry.getOwningResource().getName()));
}
}, null);
}
if (requeues == 0) {
TransactionLogResource owningResource = entry.getOwningResource();
if (owningResource instanceof Queue) {
final Queue<?> queue = (Queue<?>) owningResource;
final MessageDestination alternateBindingDestination = queue.getAlternateBindingDestination();
if (alternateBindingDestination != null) {
getEventLogger().message(ChannelMessages.DISCARDMSG_NOROUTE(msg.getMessageNumber(), alternateBindingDestination.getName()));
} else {
getEventLogger().message(ChannelMessages.DISCARDMSG_NOALTEXCH(msg.getMessageNumber(), queue.getName(), msg.getInitialRoutingAddress()));
}
}
}
}
use of org.apache.qpid.server.store.TransactionLogResource 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;
}
Aggregations