* @param client
* @param transactionId
* @param ack
*/
public void acknowledgeTransactedMessage(final BrokerClient client, final String transactionId, final MessageAck ack) throws JMSException {
Transaction transaction;
if (ack.isXaTransacted()) {
try {
transaction = transactionManager.getXATransaction(new ActiveMQXid(transactionId));
}
catch (XAException e) {
throw (JMSException) new JMSException(e.getMessage()).initCause(e);
}
}
else {
transaction = transactionManager.getLocalTransaction(transactionId);
}
transaction.addPostCommitTask(new MessageAckTransactionTask(client, ack));
transaction.addPostRollbackTask(new RedeliverMessageTransactionTask(client, ack));
// we need to tell the dispatcher that we can now accept another message
// even though we don't really ack the message until the commit
// this is because if we have a prefetch value of 1, we can never consume 2 messages
// in a transaction, since the ack for the first message never arrives until the commit