Class TransactionalDmxInterceptor
java.lang.Object
dmx.fun.quarkus.TransactionalDmxInterceptor
@NullMarked
@DmxTransactionalBinding
@Interceptor
@Priority(2100)
public class TransactionalDmxInterceptor
extends Object
CDI interceptor that backs
TransactionalResult and TransactionalTry.
Activates on any method annotated with either TransactionalResult or
TransactionalTry (both carry the shared DmxTransactionalBinding
meta-interceptor-binding, per CDI ยง2.7.1.1). For each intercepted method the
interceptor:
- Resolves the
Transactional.TxTypefrom the annotation (default REQUIRED). - Applies the corresponding JTA propagation semantics via
TxExecutor. - Rolls back (or marks rollback-only) if the returned
Resultis error orTryis failure. - Commits on success; rolls back and re-throws on any unchecked exception.
This interceptor is registered automatically when the fun-quarkus-deployment
module is on the build classpath. No manual @EnableInterceptors or
beans.xml registration is required in a standard Quarkus application.
- See Also:
-
Method Summary
-
Method Details
-
intercept
Wraps the intercepted method invocation in a JTA transaction, rolling back (or marking rollback-only when joining an existing transaction) when the returnedResultis error orTryis failure.- Parameters:
ctx- the invocation context; must not benull- Returns:
- the value returned by the intercepted method
- Throws:
IllegalStateException- if the annotated method does not returnResultorTryException- if the intercepted method throws, after rolling back the transaction
-