Search in sources :

Example 56 with XAConnection

use of javax.jms.XAConnection in project hazelcast by hazelcast.

the class WriteJmsP method init.

@Override
public void init(@Nonnull Outbox outbox, @Nonnull Context context) throws Exception {
    super.init(outbox, context);
    if (snapshotUtility.usesTransactionLifecycle()) {
        XASession xaSession = ((XAConnection) connection).createXASession();
        setXaResource(xaSession.getXAResource());
        session = xaSession;
    } else {
        session = connection.createSession(true, 0);
    }
    Destination destination = isTopic ? session.createTopic(destinationName) : session.createQueue(destinationName);
    producer = session.createProducer(destination);
}
Also used : Destination(javax.jms.Destination) XASession(javax.jms.XASession) XAConnection(javax.jms.XAConnection)

Aggregations

XAConnection (javax.jms.XAConnection)56 XASession (javax.jms.XASession)52 Test (org.junit.Test)41 MessageProducer (javax.jms.MessageProducer)40 MessageConsumer (javax.jms.MessageConsumer)35 Session (javax.jms.Session)35 TextMessage (javax.jms.TextMessage)34 XAResource (javax.transaction.xa.XAResource)29 Connection (javax.jms.Connection)28 Transaction (javax.transaction.Transaction)24 Message (javax.jms.Message)18 Xid (javax.transaction.xa.Xid)17 Queue (javax.jms.Queue)13 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)12 XAException (javax.transaction.xa.XAException)11 TemporaryQueue (javax.jms.TemporaryQueue)8 Destination (javax.jms.Destination)5 JMSException (javax.jms.JMSException)5 QueueSession (javax.jms.QueueSession)5 TopicSession (javax.jms.TopicSession)5