Hi,
In DefaultUnitOfWork.doCommit() (see code below from 2.3.2) it looks like events are published before the actual commit.
-
What is the reason for publishing the events before the commit?
-
Is there any way to publishing the events after the commit (to avoid publishing if commit fails)?
Thanks,
/ Guran P
protected void doCommit() {
do {
publishEvents();
commitInnerUnitOfWork();
} while (!this.eventsToPublish.isEmpty());
if (isTransactional()) {
notifyListenersPrepareTransactionCommit(backingTransaction);
transactionManager.commitTransaction(backingTransaction);
}
notifyListenersAfterCommit();
}