XASession


public interface XASession
extends Session
Subinterfaces: XAQueueSession and XATopicSession

WebSphere MQ class: MQXASession



java.lang.Object
   |
   +----com.ibm.mq.jms.MQXASession
 

XASession extends the capability of Session by adding access to a JMS provider's support for JTA. This support takes the form of a javax.transaction.xa.XAResource object. The functionality of this object closely resembles that defined by the standard X/Open XA Resource interface.

An application server controls the transactional assignment of an XASession by obtaining its XAResource. It uses the XAResource to assign the session to a transaction, prepare and commit work on the transaction, and so on.

An XAResource provides some fairly sophisticated facilities such as interleaving work on multiple transactions and recovering a list of transactions in progress.

A JTA-aware JMS provider must fully implement this functionality. To do this, a JMS provider could either use the services of a database that supports XA, or implement this functionality from scratch.

A client of the application server is given what appears to be a regular JMS Session. Behind the scenes, the application server controls the transaction management of the underlying XASession.

Refer to Appendix E, JMS JTA/XA interface with WebSphere Application Server V4 for details about how WebSphere MQ JMS uses XA classes.

See also: XAQueueSession and XATopicSession

Methods

commit
public void commit()
             throws JMSException

This method should not be called for an XASession object. If it is called, it throws a TransactionInProgressException.

Specified by:
commit in the Session interface.

Throws:
TransactionInProgressException - if this method is called on an XASession.

getTransacted
public boolean getTransacted()
                       throws JMSException

Always returns true.

Specified by:
getTransacted in the Session interface.

Returns:
true - if the session is in transacted mode.

Throws:
JMSException - if JMS fails to return the transaction mode because of an internal error in the JMS Provider.

getXAResource
public javax.transaction.xa.XAResource getXAResource() 

Return an XA resource to the caller.

Returns:
an XA resource to the caller.

rollback
public void rollback()
               throws JMSException

This method should not be called for an XASession object. If it is called, it throws a TransactionInProgressException.

Specified by:
rollback in the Session interface.

Throws:
TransactionInProgressException - if this method is called on an XASession.



© IBM Corporation 1997, 2002. All Rights Reserved