Hello,
I’m not sure this can be considered a bug in Axon Framework 4.5.8 but I think it is something users should be made aware of by the documentation.
I recently learned the hard way that CorrelationDataProviders are a critical section of the UnitOfWork life-cycle because they are called during exception handling, more specifically when constructing the result message, right before handling rollback.
See this excerpt from the DefaultUnitOfWork
class:
try {
result = task.call();
...
} catch (Error | Exception e) {
resultMessage = asResultMessage(e); // <-- Correlation data providers are called here
if (rollbackConfiguration.rollBackOn(e)) { // If an exception was thrown on the line before, rollback is not performed which leaves the transaction in a broken state.
rollback(e);
return resultMessage;
}
}
As I said above, I’m not sure there’s an obvious way to handle this problem, but I believe the documentation should make it obvious that exception thrown from a CorrelationDataProvider
is a no-no.