org.apache.activemq.broker
Class TransactionBroker

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

public class TransactionBroker
extends BrokerFilter

This broker filter handles the transaction related operations in the Broker interface.


Field Summary
 
Fields inherited from class org.apache.activemq.broker.BrokerFilter
next
 
Constructor Summary
TransactionBroker(Broker next, TransactionStore transactionStore)
           
 
Method Summary
 void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack)
          Used to acknowledge the receipt of a message by a client.
 void beginTransaction(ConnectionContext context, TransactionId xid)
          Starts a transaction.
 void brokerServiceStarted()
          called when the brokerService starts
 void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase)
          Commits a transaction.
 void forgetTransaction(ConnectionContext context, TransactionId xid)
          Forgets a transaction.
 TransactionId[] getPreparedTransactions(ConnectionContext context)
          Gets a list of all the prepared xa transactions.
 Transaction getTransaction(ConnectionContext context, TransactionId xid, boolean mightBePrepared)
           
 int prepareTransaction(ConnectionContext context, TransactionId xid)
          Prepares a transaction.
 void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
          A client is disconnecting from the broker.
 void removeTransaction(XATransactionId xid)
           
 void rollbackTransaction(ConnectionContext context, TransactionId xid)
          Rollsback a transaction.
 void send(ProducerBrokerExchange producerExchange, Message message)
          Send a message to the broker to using the specified destination.
 void start()
          Recovers any prepared transactions.
 void stop()
           
 
Methods inherited from class org.apache.activemq.broker.BrokerFilter
addBroker, addConnection, addConsumer, addDestination, addDestinationInfo, addProducer, addSession, fastProducer, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getPeerBrokerInfos, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, preProcessDispatch, processConsumerControl, processDispatchNotification, removeBroker, removeConsumer, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionBroker

public TransactionBroker(Broker next,
                         TransactionStore transactionStore)
Method Detail

start

public void start()
           throws Exception
Recovers any prepared transactions.

Specified by:
start in interface Service
Overrides:
start in class BrokerFilter
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Service
Overrides:
stop in class BrokerFilter
Throws:
Exception

getPreparedTransactions

public 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:
Throws:
Exception - TODO

beginTransaction

public void beginTransaction(ConnectionContext context,
                             TransactionId xid)
                      throws Exception
Description copied from interface: Broker
Starts a transaction.

Specified by:
beginTransaction in interface Broker
Overrides:
beginTransaction in class BrokerFilter
Throws:
Exception - TODO

prepareTransaction

public int prepareTransaction(ConnectionContext context,
                              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
Returns:
id
Throws:
Exception - TODO

commitTransaction

public void commitTransaction(ConnectionContext context,
                              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
Throws:
Exception - TODO

rollbackTransaction

public void rollbackTransaction(ConnectionContext context,
                                TransactionId xid)
                         throws Exception
Description copied from interface: Broker
Rollsback a transaction.

Specified by:
rollbackTransaction in interface Broker
Overrides:
rollbackTransaction in class BrokerFilter
Throws:
Exception - TODO

forgetTransaction

public void forgetTransaction(ConnectionContext context,
                              TransactionId xid)
                       throws Exception
Description copied from interface: Broker
Forgets a transaction.

Specified by:
forgetTransaction in interface Broker
Overrides:
forgetTransaction in class BrokerFilter
Throws:
Exception

acknowledge

public void acknowledge(ConsumerBrokerExchange consumerExchange,
                        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,
                 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

removeConnection

public void removeConnection(ConnectionContext context,
                             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.
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,
                                  TransactionId xid,
                                  boolean mightBePrepared)
                           throws JMSException,
                                  XAException
Throws:
JMSException
XAException

removeTransaction

public void removeTransaction(XATransactionId xid)

brokerServiceStarted

public void brokerServiceStarted()
Description copied from interface: Broker
called when the brokerService starts

Specified by:
brokerServiceStarted in interface Broker
Overrides:
brokerServiceStarted in class BrokerFilter


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.