mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4929 - remove audit from TransactionBroker
This commit is contained in:
parent
2852a8bdb1
commit
f556076a2c
|
@ -64,7 +64,6 @@ public class TransactionBroker extends BrokerFilter {
|
|||
// The prepared XA transactions.
|
||||
private TransactionStore transactionStore;
|
||||
private Map<TransactionId, XATransaction> xaTransactions = new LinkedHashMap<TransactionId, XATransaction>();
|
||||
private ActiveMQMessageAudit audit;
|
||||
|
||||
public TransactionBroker(Broker next, TransactionStore transactionStore) {
|
||||
super(next);
|
||||
|
@ -286,33 +285,14 @@ public class TransactionBroker extends BrokerFilter {
|
|||
final ConnectionContext context = producerExchange.getConnectionContext();
|
||||
Transaction originalTx = context.getTransaction();
|
||||
Transaction transaction = null;
|
||||
Synchronization sync = null;
|
||||
if (message.getTransactionId() != null) {
|
||||
transaction = getTransaction(context, message.getTransactionId(), false);
|
||||
if (transaction != null) {
|
||||
sync = new Synchronization() {
|
||||
|
||||
public void afterRollback() {
|
||||
if (audit != null) {
|
||||
audit.rollback(message);
|
||||
}
|
||||
}
|
||||
};
|
||||
transaction.addSynchronization(sync);
|
||||
}
|
||||
}
|
||||
if (audit == null || !audit.isDuplicate(message)) {
|
||||
context.setTransaction(transaction);
|
||||
try {
|
||||
next.send(producerExchange, message);
|
||||
} finally {
|
||||
context.setTransaction(originalTx);
|
||||
}
|
||||
} else {
|
||||
if (sync != null && transaction != null) {
|
||||
transaction.removeSynchronization(sync);
|
||||
}
|
||||
LOG.debug("IGNORING duplicate message {}", message);
|
||||
context.setTransaction(transaction);
|
||||
try {
|
||||
next.send(producerExchange, message);
|
||||
} finally {
|
||||
context.setTransaction(originalTx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,11 +358,4 @@ public class TransactionBroker extends BrokerFilter {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void brokerServiceStarted() {
|
||||
super.brokerServiceStarted();
|
||||
if (audit == null) {
|
||||
audit = new ActiveMQMessageAudit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue