Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQXAConnectionFactory


 
        String url = "tcp://localhost:61616";
        String qName = "MyQueue";
        int timeout = 5;
        DefaultXidFactory xidFactory = new DefaultXidFactory();
        ActiveMQXAConnectionFactory xacf = new ActiveMQXAConnectionFactory();
        xacf.setBrokerURL(url);
        ActiveMQQueue queue = new ActiveMQQueue();
        queue.setPhysicalName(qName);
        XAConnection xaconn = xacf.createXAConnection();
        xaconn.start();
        XASession session = xaconn.createXASession();
        XAResource xares = session.getXAResource();
        MessageConsumer receiver = session.getSession().createConsumer(queue);
        xares.recover(XAResource.TMSTARTRSCAN);
View Full Code Here


    @Override
    public void setUp() throws Exception {
        super.setUp();

        factory = new ActiveMQXAConnectionFactory(
            connectionUri + "?jms.prefetchPolicy.all=0&jms.redeliveryPolicy.maximumRedeliveries="+messagesExpected);
    }
View Full Code Here

    public void testAckModeOfPoolNonXAWithTM() throws Exception {
        final Vector<Synchronization> syncs = new Vector<Synchronization>();
        ActiveMQTopic topic = new ActiveMQTopic("test");
        XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE));

        // simple TM that is in a tx and will track syncs
        pcf.setTransactionManager(new TransactionManager(){
            @Override
            public void begin() throws NotSupportedException, SystemException {
View Full Code Here

        broker.start();
    }

    public void testEnhancedConnection() throws Exception {
        XaPooledConnectionFactory pooledFactory =
                new XaPooledConnectionFactory(new ActiveMQXAConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false"));

        PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
        EnhancedConnection enhancedConnection = (EnhancedConnection)connection.getConnection();
        DestinationSource destinationSource = enhancedConnection.getDestinationSource();
        assertNotNull(destinationSource);
View Full Code Here

    }

    public void testEvictionXA() throws Exception {
        XaPooledConnectionFactory pooledFactory =
                new XaPooledConnectionFactory(new ActiveMQXAConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false"));

        doTestEviction(pooledFactory);
    }
View Full Code Here

     * causing the failover transport to reconnect and replay the XA prepare().
     */
    public void testXAPrepareFailure() throws Exception {

        assertNotNull(connectionUri);
        ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory("failover:(" + connectionUri + ")");
        ActiveMQXAConnection xaConnection = (ActiveMQXAConnection)cf.createConnection();
        xaConnection.start();
        XASession session = xaConnection.createXASession();
        XAResource resource = session.getXAResource();
        Xid tid = createXid();
        resource.start(tid, XAResource.TMNOFLAGS);
View Full Code Here

    // https://issues.apache.org/jira/browse/AMQ-3251
    public void testAfterCompletionCanClose() throws Exception {
        final Vector<Synchronization> syncs = new Vector<Synchronization>();
        ActiveMQTopic topic = new ActiveMQTopic("test");
        XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));

        // simple TM that is in a tx and will track syncs
        pcf.setTransactionManager(new TransactionManager(){
            @Override
            public void begin() throws NotSupportedException, SystemException {
View Full Code Here

    public void testAckModeOfPoolNonXAWithTM() throws Exception {
        final Vector<Synchronization> syncs = new Vector<Synchronization>();
        ActiveMQTopic topic = new ActiveMQTopic("test");
        XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE));

        // simple TM that is in a tx and will track syncs
        pcf.setTransactionManager(new TransactionManager(){
            @Override
            public void begin() throws NotSupportedException, SystemException {
View Full Code Here

        assertFalse(pcf.isTmFromJndi());
    }

    public void testSenderAndPublisherDest() throws Exception {
        XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));

        QueueConnection connection = pcf.createQueueConnection();
        QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        QueueSender sender = session.createSender(session.createQueue("AA"));
        assertNotNull(sender.getQueue().getQueueName());
View Full Code Here

        topicConnection.close();
    }

    public void testSessionArgsIgnoredWithTm() throws Exception {
        XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
        // simple TM that with no tx
        pcf.setTransactionManager(new TransactionManager() {
            @Override
            public void begin() throws NotSupportedException, SystemException {
                throw new SystemException("NoTx");
View Full Code Here

TOP

Related Classes of org.apache.activemq.ActiveMQXAConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.