-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
13.0.0.Beta1, 13.0.0.Final, 14.0.0.Final, 26.1.1.Final
-
None
-
-
---
-
---
When a transaction is active the TransactedJMSContext is injected for the JMSContext. However, if the JMSContext is first interacted with while the transaction is already committing (i.e. from a Hibernate lifecycle listener or another JTA transaction synchronization), it can not place it's own JTA transaction synchronization and will fail to instantiate.
This issue is kind of similar to the same issue with firing events with transactional observers during the committing phase (WELD-2444 and CDI-724).
However, I think in the case of the TransactedJMSContext the issue can be quite easily solved by relying on the PreDestroy of the transaction context, just like the RequestedJMSContext does. I don't see what the added benefit of a transaction synchronization is here.
Relevant classes: https://github.com/wildfly/wildfly/blob/main/messaging-activemq/injection/src/main/java/org/wildfly/extension/messaging/activemq/deployment/injection/RequestedJMSContext.java#L36-L40 and https://github.com/wildfly/wildfly/blob/main/messaging-activemq/injection/src/main/java/org/wildfly/extension/messaging/activemq/deployment/injection/TransactedJMSContext.java#L38
I.e. use:
@PreDestroy
@Override
void cleanUp() {
super.cleanUp();
}
instead of:
transactionSynchronizationRegistry.registerInterposedSynchronization(new AfterCompletionSynchronization(contextInstance));