activemq::core::ActiveMQTransactionContext Class Reference

Transaction Management class, hold messages that are to be redelivered upon a request to roll-back. More...

#include <src/main/activemq/core/ActiveMQTransactionContext.h>

Inheritance diagram for activemq::core::ActiveMQTransactionContext:
Inheritance graph
[legend]

Public Member Functions

 ActiveMQTransactionContext (activemq::core::kernels::ActiveMQSessionKernel *session, const decaf::util::Properties &properties)
 Constructor.
virtual ~ActiveMQTransactionContext ()
virtual void addSynchronization (const Pointer< Synchronization > &sync)
 Adds a Synchronization to this Transaction.
virtual void removeSynchronization (const Pointer< Synchronization > &sync)
 Removes a Synchronization to this Transaction.
virtual void begin ()
 Begins a new transaction if one is not currently in progress.
virtual void commit ()
 Commit the current Transaction.
virtual void rollback ()
 Rollback the current Transaction.
virtual const
decaf::lang::Pointer
< commands::TransactionId > & 
getTransactionId () const
 Get the Transaction Id object for the current Transaction, returns NULL if no transaction is running.
virtual bool isInTransaction () const
 Checks to see if there is currently a Transaction in progress returns false if not, true otherwise.
virtual bool isInLocalTransaction () const
 Checks to see if there is currently an Local Transaction in progess, returns false if not, true otherwise.
virtual bool isInXATransaction () const
 Checks to see if there is currently an XA Transaction in progess, returns false if not, true otherwise.
virtual void commit (const cms::Xid *xid, bool onePhase)
 Commits a global transaction.
virtual void end (const cms::Xid *xid, int flags)
 Ends the work done for a transaction branch.
virtual void forget (const cms::Xid *xid)
 Informs the Resource Manager that it can forget about a specified transaction branch.
virtual int getTransactionTimeout () const
 Gets the transaction timeout value for this XAResource.
virtual bool isSameRM (const cms::XAResource *theXAResource)
virtual int prepare (const cms::Xid *xid)
 Requests the Resource manager to prepare to commit a specified transaction.
virtual int recover (int flag, cms::Xid **recovered)
 Get a list of prepared transaction branches.
virtual void rollback (const cms::Xid *xid)
 Requests the Resource Manager to rollback a specified transaction branch.
virtual bool setTransactionTimeout (int seconds)
 Sets the transaction timeout value for this XAResource.
virtual void start (const cms::Xid *xid, int flags)
 Starts work for a specified transaction branch.

Detailed Description

Transaction Management class, hold messages that are to be redelivered upon a request to roll-back.

The Transaction represents an always running transaction, when it is committed or rolled back it silently creates a new transaction for the next set of messages. The only way to permanently end this transaction is to delete it.

Since:
2.0

Constructor & Destructor Documentation

activemq::core::ActiveMQTransactionContext::ActiveMQTransactionContext ( activemq::core::kernels::ActiveMQSessionKernel session,
const decaf::util::Properties properties 
)

Constructor.

Parameters:
session The session that contains this transaction
properties Configuration parameters for this object
virtual activemq::core::ActiveMQTransactionContext::~ActiveMQTransactionContext (  )  [virtual]

Member Function Documentation

virtual void activemq::core::ActiveMQTransactionContext::addSynchronization ( const Pointer< Synchronization > &  sync  )  [virtual]

Adds a Synchronization to this Transaction.

Parameters:
sync - The Synchronization instance to add.
virtual void activemq::core::ActiveMQTransactionContext::begin (  )  [virtual]

Begins a new transaction if one is not currently in progress.

Exceptions:
ActiveMQException 
virtual void activemq::core::ActiveMQTransactionContext::commit ( const cms::Xid xid,
bool  onePhase 
) [virtual]

Commits a global transaction.

Parameters:
xid the XID which identifies the global transaction.
onePhase true if the resource manager should use a one-phase commit protocol to commit the transaction.
Exceptions:
XAException if an error occurred.

Possible errors are identified by the errorcode in the XAException and include: XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO. In addition, one of the XA_RB* errors can occur if the transaction was not committed and onePhase was set to true. On completion of this method, the Resource Manager has rolled back the transaction and released resources held by the transaction.

Implements cms::XAResource.

virtual void activemq::core::ActiveMQTransactionContext::commit (  )  [virtual]

Commit the current Transaction.

Exceptions:
ActiveMQException 
virtual void activemq::core::ActiveMQTransactionContext::end ( const cms::Xid xid,
int  flags 
) [virtual]

Ends the work done for a transaction branch.

The Resource Manager disconnects the XA resource from the transaction branch and allows the transaction to complete.

Parameters:
xid the XID which identifies the global transaction. Should have previously been used as the parameter to a start. method.
flags a flags integer - one of: XAResource::TMSUCCESS, XAResource::TMFAIL, or XAResource::TMSUSPEND.

TMSUCCESS means that this section of work completed successfully.

TMFAIL means that this section of work failed. The Resource Manager can mark the transaction for rollback only.

TMSUSPEND means that this section of work is suspended and not yet complete. The associated transaction context is also suspended and must be restarted with a call to start(Xid, int) with the TMRESUME flag.

Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB*.

Implements cms::XAResource.

virtual void activemq::core::ActiveMQTransactionContext::forget ( const cms::Xid xid  )  [virtual]

Informs the Resource Manager that it can forget about a specified transaction branch.

Parameters:
xid the XID which identifies the global transaction.
Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

Implements cms::XAResource.

virtual const decaf::lang::Pointer<commands::TransactionId>& activemq::core::ActiveMQTransactionContext::getTransactionId (  )  const [virtual]

Get the Transaction Id object for the current Transaction, returns NULL if no transaction is running.

Returns:
TransactionInfo
Exceptions:
InvalidStateException if a Transaction is not in progress.
virtual int activemq::core::ActiveMQTransactionContext::getTransactionTimeout (  )  const [virtual]

Gets the transaction timeout value for this XAResource.

The default timeout value is the default timeout value set for the Resource Manager.

Returns:
the transaction timeout value for this XAResource in seconds.
Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XAER_RMERR and XAER_RMFAIL.

Implements cms::XAResource.

virtual bool activemq::core::ActiveMQTransactionContext::isInLocalTransaction (  )  const [virtual]

Checks to see if there is currently an Local Transaction in progess, returns false if not, true otherwise.

Returns:
true if an Local Transaction is in progress.
virtual bool activemq::core::ActiveMQTransactionContext::isInTransaction (  )  const [virtual]

Checks to see if there is currently a Transaction in progress returns false if not, true otherwise.

Returns:
true if a transaction is in progress.
virtual bool activemq::core::ActiveMQTransactionContext::isInXATransaction (  )  const [virtual]

Checks to see if there is currently an XA Transaction in progess, returns false if not, true otherwise.

Returns:
true if an XA Transaction is in progress.
virtual bool activemq::core::ActiveMQTransactionContext::isSameRM ( const cms::XAResource theXAResource  )  [virtual]
virtual int activemq::core::ActiveMQTransactionContext::prepare ( const cms::Xid xid  )  [virtual]

Requests the Resource manager to prepare to commit a specified transaction.

Parameters:
xid the XID which identifies the global transaction.
Returns:
an integer: XA_RDONLY or XA_OK. XA_OK implies that the transaction work has been prepared normally, XA_RDONLY implies that the transaction branch is read only and has been committed. If there is a failure which requires a rollback, an XAException is raised.
Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

Implements cms::XAResource.

virtual int activemq::core::ActiveMQTransactionContext::recover ( int  flag,
cms::Xid **  recovered 
) [virtual]

Get a list of prepared transaction branches.

Typically used by a transaction manager during recovery to find transaction branches that are in prepared or heuristically completed states.

Parameters:
flag an integer. Must be one of: XAResource::TMSTARTRSCAN, XAResource::TMENDRSCAN, XAResource::TMNOFLAGS.
Returns:
an array of zero or more XIDs identifying the transaction branches in the prepared or heuristically completed states.
Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.

Implements cms::XAResource.

virtual void activemq::core::ActiveMQTransactionContext::removeSynchronization ( const Pointer< Synchronization > &  sync  )  [virtual]

Removes a Synchronization to this Transaction.

Parameters:
sync - The Synchronization instance to add.
virtual void activemq::core::ActiveMQTransactionContext::rollback ( const cms::Xid xid  )  [virtual]

Requests the Resource Manager to rollback a specified transaction branch.

Parameters:
xid the XID which identifies the transaction branch.
Exceptions:
XAException if an error occurs.

Implements cms::XAResource.

virtual void activemq::core::ActiveMQTransactionContext::rollback (  )  [virtual]

Rollback the current Transaction.

Exceptions:
ActiveMQException 
virtual bool activemq::core::ActiveMQTransactionContext::setTransactionTimeout ( int  seconds  )  [virtual]

Sets the transaction timeout value for this XAResource.

If the value is set to 0, the default timeout value for the Resource Manager is used.

Parameters:
seconds the new Timeout value in seconds.
Returns:
true if the transaction timeout value has been updated, false otherwise.
Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.

Implements cms::XAResource.

virtual void activemq::core::ActiveMQTransactionContext::start ( const cms::Xid xid,
int  flags 
) [virtual]

Starts work for a specified transaction branch.

Parameters:
xid the XID which identifies the transaction branch.
flags an integer. Must be one of XAResource::TMNOFLAGS, XAResource::TMJOIN, or XAResource::TMRESUME.

TMJOIN implies that the start applies to joining a transaction previously passed to the Resource Manager.

TMRESUME implies that the start applies to a suspended transaction that should be restarted.

If TMNOFLAGS is specified, then if the transaction has been previously seen by the Resource Manager, an XAException is raised with the code XAER_DUPID.

Exceptions:
XAException if an error occurs. Possible error identified in the errorcode include: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

Implements cms::XAResource.


The documentation for this class was generated from the following file:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1