Package org.apache.activemq.broker
Class TransactionBroker
- java.lang.Object
-
- org.apache.activemq.broker.BrokerFilter
-
- org.apache.activemq.broker.TransactionBroker
-
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
Constructors Constructor Description TransactionBroker(Broker next, TransactionStore transactionStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
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, brokerServiceStarted, fastProducer, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getNext, getPeerBrokerInfos, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, preProcessDispatch, processConsumerControl, processDispatchNotification, reapplyInterceptor, removeBroker, removeConsumer, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, virtualDestinationAdded, virtualDestinationRemoved
-
-
-
-
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 interfaceService
- Overrides:
start
in classBrokerFilter
- Throws:
Exception
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceService
- Overrides:
stop
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
getPreparedTransactions
in classBrokerFilter
- Parameters:
context
- transaction ids- Returns:
- array of TransactionId values
- 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 interfaceBroker
- Overrides:
beginTransaction
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
prepareTransaction
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
commitTransaction
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
rollbackTransaction
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
forgetTransaction
in classBrokerFilter
- 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 interfaceRegion
- Overrides:
acknowledge
in classBrokerFilter
- 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 interfaceRegion
- Overrides:
send
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
removeConnection
in classBrokerFilter
- 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)
-
-