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:

  1. Resolves the Transactional.TxType from the annotation (default REQUIRED).
  2. Applies the corresponding JTA propagation semantics via TxExecutor.
  3. Rolls back (or marks rollback-only) if the returned Result is error or Try is failure.
  4. 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 Details

    • intercept

      public Object intercept(jakarta.interceptor.InvocationContext ctx) throws Exception
      Wraps the intercepted method invocation in a JTA transaction, rolling back (or marking rollback-only when joining an existing transaction) when the returned Result is error or Try is failure.
      Parameters:
      ctx - the invocation context; must not be null
      Returns:
      the value returned by the intercepted method
      Throws:
      IllegalStateException - if the annotated method does not return Result or Try
      Exception - if the intercepted method throws, after rolling back the transaction