Class ActiveMQRAXAResource

  • All Implemented Interfaces:
    XAResource, org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource

    public class ActiveMQRAXAResource
    extends Object
    implements org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource
    ActiveMQXAResource.
    • Constructor Detail

      • ActiveMQRAXAResource

        public ActiveMQRAXAResource​(ActiveMQRAManagedConnection managedConnection,
                                    XAResource xaResource)
        Create a new ActiveMQXAResource.
        Parameters:
        managedConnection - the managed connection
        xaResource - the xa resource
    • Method Detail

      • start

        public void start​(Xid xid,
                          int flags)
                   throws XAException
        Start
        Specified by:
        start in interface XAResource
        Parameters:
        xid - A global transaction identifier
        flags - One of TMNOFLAGS, TMJOIN, or TMRESUME
        Throws:
        XAException - An error has occurred
      • end

        public void end​(Xid xid,
                        int flags)
                 throws XAException
        End
        Specified by:
        end in interface XAResource
        Parameters:
        xid - A global transaction identifier
        flags - One of TMSUCCESS, TMFAIL, or TMSUSPEND.
        Throws:
        XAException - An error has occurred
      • prepare

        public int prepare​(Xid xid)
                    throws XAException
        Prepare
        Specified by:
        prepare in interface XAResource
        Parameters:
        xid - A global transaction identifier
        Returns:
        XA_RDONLY or XA_OK
        Throws:
        XAException - An error has occurred
      • commit

        public void commit​(Xid xid,
                           boolean onePhase)
                    throws XAException
        Commit
        Specified by:
        commit in interface XAResource
        Parameters:
        xid - A global transaction identifier
        onePhase - If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.
        Throws:
        XAException - An error has occurred
      • rollback

        public void rollback​(Xid xid)
                      throws XAException
        Rollback
        Specified by:
        rollback in interface XAResource
        Parameters:
        xid - A global transaction identifier
        Throws:
        XAException - An error has occurred
      • forget

        public void forget​(Xid xid)
                    throws XAException
        Forget
        Specified by:
        forget in interface XAResource
        Parameters:
        xid - A global transaction identifier
        Throws:
        XAException - An error has occurred
      • isSameRM

        public boolean isSameRM​(XAResource xaRes)
                         throws XAException
        IsSameRM
        Specified by:
        isSameRM in interface XAResource
        Parameters:
        xaRes - An XAResource object whose resource manager instance is to be compared with the resource manager instance of the target object.
        Returns:
        True if its the same RM instance; otherwise false.
        Throws:
        XAException - An error has occurred
      • recover

        public Xid[] recover​(int flag)
                      throws XAException
        Recover
        Specified by:
        recover in interface XAResource
        Parameters:
        flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS
        Returns:
        Zero or more XIDs
        Throws:
        XAException - An error has occurred
      • setTransactionTimeout

        public boolean setTransactionTimeout​(int seconds)
                                      throws XAException
        Set the transaction timeout
        Specified by:
        setTransactionTimeout in interface XAResource
        Parameters:
        seconds - The number of seconds
        Returns:
        True if the transaction timeout value is set successfully; otherwise false.
        Throws:
        XAException - An error has occurred
      • getResource

        public XAResource getResource()
        Specified by:
        getResource in interface org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource