Package org.codehaus.activemq

Examples of org.codehaus.activemq.ActiveMQConnectionFactory.createConnection()


        }
    }

    protected Connection createConnection() throws JMSException {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pwd, url);
        return connectionFactory.createConnection();
    }

    protected void close() throws JMSException {
        // lets dump the stats
        dumpStats();
View Full Code Here


        return session;
    }

    protected Connection createConnection() throws JMSException, Exception {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pwd, url);
        Connection connection = connectionFactory.createConnection();
        if (durable) {
            connection.setClientID(clientID);
        }
        connection.start();
        return connection;
View Full Code Here

     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        ConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost");
        producerConnection = fac.createConnection();
        Session s = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination dest = s.createTopic(getClass().getName());
        MessageProducer producer = s.createProducer(dest);
        consumerConnection = fac.createConnection();
        s = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        ConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost");
        producerConnection = fac.createConnection();
        Session s = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination dest = s.createTopic(getClass().getName());
        MessageProducer producer = s.createProducer(dest);
        consumerConnection = fac.createConnection();
        s = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = s.createConsumer(dest);
        consumerConnection.start();
        out = new DataOutputStream(new JMSOutputStream(producer));
        in = new DataInputStream(new JMSInputStream(consumer));
View Full Code Here

        String topicName = "TestTopic";
        String clientID = getName();
        String subscriberName = "MySubscriber:"+System.currentTimeMillis();

        Connection connection = connectionFactory.createConnection();
        connection.setClientID(clientID);

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTopic(topicName);
View Full Code Here

        session.close();
        session = null;

        // Create the new connection before closing to avoid the broker shutting down.
        // now create a new Connection, Session &  Producer, send some messages & then close
        Connection t = connectionFactory.createConnection();       
        connection.close();
        connection = t;
       
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        topic = session.createTopic(topicName);
View Full Code Here

        session.close();
        session = null;

        // Now (re)register the Durable subscriber, setup a listener and wait for messages that should
        // have been published by the previous producer
        t = connectionFactory.createConnection();       
        connection.close();
        connection = t;
       
        connection.setClientID(clientID);
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

            if (embeddedBroker) {
                factory.setUseEmbeddedBroker(true);
            }

            factory.setTurboBoost(true);
            return factory.createConnection();
        }
    }

    /**
     * Creates a Destination object through Session using subject.
View Full Code Here

    public void testTransaction() throws Exception {

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");

        factory.setUseEmbeddedBroker(true);
        connection = factory.createConnection();
        queue = new ActiveMQQueue(getClass().getName() + "." + getName());

        producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        consumerSession = connection.createSession(true, 0);
View Full Code Here

        // start a client
        ActiveMQConnectionFactory factory = new
                ActiveMQConnectionFactory("tcp://localhost:9100");
        factory.start();
        factory.createConnection();

        // stop activemq broker
        container.stop();

        // start activemq broker again
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.