Search in sources :

Example 1 with ActiveMQXAConnectionFactory

use of org.apache.activemq.ActiveMQXAConnectionFactory in project cxf by apache.

the class MessageListenerTest method createXAConnection.

private Connection createXAConnection(String name, TransactionManager tm) throws JMSException {
    ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory("vm://" + name + "?broker.persistent=false");
    cf.setRedeliveryPolicy(redeliveryPolicy());
    XaPooledConnectionFactory cfp = new XaPooledConnectionFactory(cf);
    cfp.setTransactionManager(tm);
    cfp.setConnectionFactory(cf);
    Connection connection = cfp.createConnection();
    connection.start();
    return connection;
}
Also used : XaPooledConnectionFactory(org.apache.activemq.pool.XaPooledConnectionFactory) Connection(javax.jms.Connection) ActiveMQXAConnectionFactory(org.apache.activemq.ActiveMQXAConnectionFactory)

Example 2 with ActiveMQXAConnectionFactory

use of org.apache.activemq.ActiveMQXAConnectionFactory in project cxf by apache.

the class JMSTransactionTest method startBusAndJMS.

public static void startBusAndJMS(String brokerURI) {
    try {
        transactionManager = new GeronimoTransactionManager();
    } catch (XAException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
    bus = BusFactory.getDefaultBus();
    registerTransactionManager();
    ActiveMQXAConnectionFactory cf1 = new ActiveMQXAConnectionFactory(brokerURI);
    cf1.setRedeliveryPolicy(redeliveryPolicy());
    JcaPooledConnectionFactory pcf = new JcaPooledConnectionFactory();
    pcf.setTransactionManager(transactionManager);
    pcf.setConnectionFactory(cf1);
    cf = pcf;
    cff = new ConnectionFactoryFeature(pcf);
}
Also used : XAException(javax.transaction.xa.XAException) JcaPooledConnectionFactory(org.apache.activemq.jms.pool.JcaPooledConnectionFactory) ConnectionFactoryFeature(org.apache.cxf.transport.jms.ConnectionFactoryFeature) GeronimoTransactionManager(org.apache.geronimo.transaction.manager.GeronimoTransactionManager) ActiveMQXAConnectionFactory(org.apache.activemq.ActiveMQXAConnectionFactory)

Aggregations

ActiveMQXAConnectionFactory (org.apache.activemq.ActiveMQXAConnectionFactory)2 Connection (javax.jms.Connection)1 XAException (javax.transaction.xa.XAException)1 JcaPooledConnectionFactory (org.apache.activemq.jms.pool.JcaPooledConnectionFactory)1 XaPooledConnectionFactory (org.apache.activemq.pool.XaPooledConnectionFactory)1 ConnectionFactoryFeature (org.apache.cxf.transport.jms.ConnectionFactoryFeature)1 GeronimoTransactionManager (org.apache.geronimo.transaction.manager.GeronimoTransactionManager)1