consumerExchange.setConnectionContext(context);
transactionStore.recover(new TransactionRecoveryListener() {
public void recover(XATransactionId xid, Message[] addedMessages, MessageAck[] aks) {
try {
beginTransaction(context, xid);
XATransaction transaction = (XATransaction) getTransaction(context, xid, false);
for (int i = 0; i < addedMessages.length; i++) {
forceDestinationWakeupOnCompletion(context, transaction, addedMessages[i].getDestination(), addedMessages[i]);
}
for (int i = 0; i < aks.length; i++) {
forceDestinationWakeupOnCompletion(context, transaction, aks[i].getDestination(), aks[i]);
}
transaction.setState(Transaction.PREPARED_STATE);
registerMBean(transaction);
if (LOG.isDebugEnabled()) {
LOG.debug("recovered prepared transaction: " + transaction.getTransactionId());
}
} catch (Throwable e) {
throw new WrappedException(e);
}
}