{
final List<AMQQueue> rerouteQueues = alternateExchange.route(new InboundMessageAdapter(this));
final ServerMessage message = getMessage();
if(rerouteQueues != null && rerouteQueues.size() != 0)
{
ServerTransaction txn = new AutoCommitTransaction(getQueue().getVirtualHost().getTransactionLog());
txn.enqueue(rerouteQueues, message, new ServerTransaction.Action() {
public void postCommit()
{
try
{
for(AMQQueue queue : rerouteQueues)
{
QueueEntry entry = queue.enqueue(message);
}
}
catch (AMQException e)
{
throw new RuntimeException(e);
}
}
public void onRollback()
{
}
});
txn.dequeue(currentQueue,message,
new ServerTransaction.Action()
{
public void postCommit()
{
discard();