Class TransactionBroker

java.lang.Object
org.apache.activemq.broker.BrokerFilter
org.apache.activemq.broker.TransactionBroker
All Implemented Interfaces:
Broker, Region, org.apache.activemq.Service

public class TransactionBroker extends BrokerFilter
This broker filter handles the transaction related operations in the Broker interface.
  • Constructor Details

  • Method Details

    • start

      public void start() throws Exception
      Recovers any prepared transactions.
      Specified by:
      start in interface org.apache.activemq.Service
      Overrides:
      start in class BrokerFilter
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface org.apache.activemq.Service
      Overrides:
      stop in class BrokerFilter
      Throws:
      Exception
    • getPreparedTransactions

      public org.apache.activemq.command.TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception
      Description copied from interface: Broker
      Gets a list of all the prepared xa transactions.
      Specified by:
      getPreparedTransactions in interface Broker
      Overrides:
      getPreparedTransactions in class BrokerFilter
      Parameters:
      context - transaction ids
      Returns:
      array of TransactionId values
      Throws:
      Exception - TODO
    • beginTransaction

      public void beginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Starts a transaction.
      Specified by:
      beginTransaction in interface Broker
      Overrides:
      beginTransaction in class BrokerFilter
      Parameters:
      context - connection context
      xid - transaction id
      Throws:
      Exception - TODO
    • prepareTransaction

      public int prepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Prepares a transaction. Only valid for xa transactions.
      Specified by:
      prepareTransaction in interface Broker
      Overrides:
      prepareTransaction in class BrokerFilter
      Parameters:
      context - connection context
      xid - transaction id
      Returns:
      id
      Throws:
      Exception - TODO
    • commitTransaction

      public void commitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) throws Exception
      Description copied from interface: Broker
      Commits a transaction.
      Specified by:
      commitTransaction in interface Broker
      Overrides:
      commitTransaction in class BrokerFilter
      Parameters:
      context - connection context
      xid - transaction id
      onePhase - is COMMIT_ONE_PHASE
      Throws:
      Exception - TODO
    • rollbackTransaction

      public void rollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Rollback a transaction.
      Specified by:
      rollbackTransaction in interface Broker
      Overrides:
      rollbackTransaction in class BrokerFilter
      Parameters:
      context - connection context
      xid - transaction id
      Throws:
      Exception - TODO
    • forgetTransaction

      public void forgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception
      Description copied from interface: Broker
      Forgets a transaction.
      Specified by:
      forgetTransaction in interface Broker
      Overrides:
      forgetTransaction in class BrokerFilter
      Parameters:
      context - connection context
      xid - transaction id
      Throws:
      Exception - TODO
    • acknowledge

      public void acknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) throws Exception
      Description copied from interface: Region
      Used to acknowledge the receipt of a message by a client.
      Specified by:
      acknowledge in interface Region
      Overrides:
      acknowledge in class BrokerFilter
      Parameters:
      consumerExchange - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • send

      public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message) throws Exception
      Description copied from interface: Region
      Send a message to the broker to using the specified destination. The destination specified in the message does not need to match the destination the message is sent to. This is handy in case the message is being sent to a dead letter destination.
      Specified by:
      send in interface Region
      Overrides:
      send in class BrokerFilter
      Parameters:
      producerExchange - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • verifyUncommittedCount

      protected void verifyUncommittedCount(ProducerBrokerExchange producerExchange, Transaction transaction, org.apache.activemq.command.Message message) throws Exception
      Throws:
      Exception
    • removeConnection

      public void removeConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) throws Exception
      Description copied from interface: Broker
      A client is disconnecting from the broker.
      Specified by:
      removeConnection in interface Broker
      Overrides:
      removeConnection in class BrokerFilter
      Parameters:
      context - the environment the operation is being executed under.
      info - metadata about the Broker
      error - null if the client requested the disconnect or the error that caused the client to disconnect.
      Throws:
      Exception - TODO
    • getTransaction

      public Transaction getTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean mightBePrepared) throws jakarta.jms.JMSException, XAException
      Throws:
      jakarta.jms.JMSException
      XAException
    • removeTransaction

      public void removeTransaction(org.apache.activemq.command.XATransactionId xid)