Based on CDI-578. The spec does not define behavior when you fire an event for an observer with transaction when the transaction itself is not active anymore (or was rolled back).
We should determine how to react to such events.
There are two cases:
-
Bean Managed Transaction (BMT)
-
Dirty reproducer can be found here
-
In this scenario no exception was thrown
-
All observers were notified in the following order: IN_PROGRESS, AFTER_COMPLETION,AFTER_FAILURE, BEFORE_COMPLETION, AFTER_SUCCESS
-
method org.jboss.weld.event.TransactionalObserverNotifier.deferNotification(T, EventMetadata, ObserverMethod<? super T>) was not called at all
-
Container Managed Transaction (CMT)
-
Dirty reproducer available here
-
This throws WFLYTX0029: Syncs are not allowed to be registered when the tx is in state 1, where state 1 stand for STATUS_MARKED_ROLLBACK
-
The exception is thrown as soon as you attempt to fire the event, so obviously no observers are notified
|