com.atomikos.jms
Class JtaQueueConnectionFactory

java.lang.Object
  extended by com.atomikos.jms.JtaQueueConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory, Referenceable

public class JtaQueueConnectionFactory
extends Object
implements javax.jms.QueueConnectionFactory, Referenceable

A queue connection factory that couples JMS queue sends/receives to JTA transactions. Use this class only if you need to do explicit resource registration with the transaction service (i.e., when the underlying vendor-specific XAResource implementation is not fully compliant with the JTA/XA specifications, or if you want to force recovery at TM startup time). In all other cases, the QueueConnectionFactoryBean class is preferred over this one.

Use this class if you want to make queue send/receive operations within the scope of a JTA transaction. This class requires explicit resource registration with the transaction service: you need to explicitly call getTransactionalResource() and register the result with the UserTransactionService:

XAQueueConnectionFactory xafactory = ... //vendor-specific code
JtaQueueConnectionFactory factory =
new JtaQueueConnectionFactory ( xafactory );
com.atomikos.datasource.TransactionalResource resource = factory.getTransactionalResource();
com.atomikos.icatch.UserTransactionService uts = new com.atomikos.icatch.UserTransactionServiceImp();
uts.registerResource ( resource );


Constructor Summary
JtaQueueConnectionFactory(String resourceName, javax.jms.XAQueueConnectionFactory factory)
          Create a new instance with a given JMS vendor-supplied xa connection factory.
JtaQueueConnectionFactory(String resourceName, javax.jms.XAQueueConnectionFactory qFactory, XidFactory xFactory)
          Create a new instance with a given JMS vendor-supplied xa connection factory, and a specific XidFactory.
 
Method Summary
 javax.jms.Connection createConnection()
          Creates a default connection.
 javax.jms.Connection createConnection(String userName, String password)
          Creates a connection for a given user and password.
 javax.jms.QueueConnection createQueueConnection()
          Creates a default connection.
 javax.jms.QueueConnection createQueueConnection(String user, String pw)
          Creates a connection for a given user and password.
 Reference getReference()
           
 JmsTransactionalResource getTransactionalResource()
          Gets the transactional resource created during initialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JtaQueueConnectionFactory

public JtaQueueConnectionFactory(String resourceName,
                                 javax.jms.XAQueueConnectionFactory factory)
Create a new instance with a given JMS vendor-supplied xa connection factory.

Parameters:
resourceName - The unique name for the transactional resource that will be created.
factory - The JMS vendor-supplied xa connection factory.

JtaQueueConnectionFactory

public JtaQueueConnectionFactory(String resourceName,
                                 javax.jms.XAQueueConnectionFactory qFactory,
                                 XidFactory xFactory)
Create a new instance with a given JMS vendor-supplied xa connection factory, and a specific XidFactory.

Parameters:
resourceName - The unique name for the transactional resource that will be created.
qFactory - The JMS vendor-supplied xa connection factory.
xFactory - The XidFactory.
Method Detail

getTransactionalResource

public JmsTransactionalResource getTransactionalResource()
Gets the transactional resource created during initialization.

Returns:
JmsTransactionalResource The resource. This should be added to the transaction service's recoverable resources.

createQueueConnection

public javax.jms.QueueConnection createQueueConnection()
                                                throws javax.jms.JMSException
Creates a default connection.

Specified by:
createQueueConnection in interface javax.jms.QueueConnectionFactory
Returns:
QueueConnection The connection.
Throws:
javax.jms.JMSException

createQueueConnection

public javax.jms.QueueConnection createQueueConnection(String user,
                                                       String pw)
                                                throws javax.jms.JMSException
Creates a connection for a given user and password.

Specified by:
createQueueConnection in interface javax.jms.QueueConnectionFactory
Parameters:
user - The user name.
pw - The password.
Returns:
QueueConnection The connection.
Throws:
javax.jms.JMSException

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException
See Also:
Referenceable

createConnection

public javax.jms.Connection createConnection()
                                      throws javax.jms.JMSException
Creates a default connection.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Returns:
Connection The connection.
Throws:
javax.jms.JMSException

createConnection

public javax.jms.Connection createConnection(String userName,
                                             String password)
                                      throws javax.jms.JMSException
Creates a connection for a given user and password.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Parameters:
userName - The user name.
password - The password.
Returns:
Connection The connection.
Throws:
javax.jms.JMSException


Copyright © 2011. All Rights Reserved.