{
final List<? extends BaseQueue> 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(BaseQueue queue : rerouteQueues)
{
queue.enqueue(message);
}
}
catch (AMQException e)
{
throw new RuntimeException(e);
}
}
public void onRollback()
{
}
});
txn.dequeue(currentQueue,message,
new ServerTransaction.Action()
{
public void postCommit()
{
discard();