{
if (!entry.getDeliveredToConsumer() && entry.acquire())
{
ServerTransaction txn = new LocalTransaction(_messageStore);
Collection<QueueEntry> entries = new ArrayList<QueueEntry>(1);
entries.add(entry);
final AMQMessage message = (AMQMessage) entry.getMessage();
txn.dequeue(_queue, entry.getMessage(),
new MessageAcknowledgeAction(entries)
{
@Override
public void postCommit()
{
try
{
final
ProtocolOutputConverter outputConverter =
_session.getProtocolOutputConverter();
outputConverter.writeReturn(message.getMessagePublishInfo(),
message.getContentHeaderBody(),
message,
_channelId,
AMQConstant.NO_CONSUMERS.getCode(),
IMMEDIATE_DELIVERY_REPLY_TEXT);
}
catch (AMQException e)
{
throw new RuntimeException(e);
}
super.postCommit();
}
}
);
txn.commit();
}
}