Package org.codehaus.activemq

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


    }
       
    protected void createConnection() throws JMSException {
        String providerURL = getProviderURL();
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pwd, providerURL);
        connection = connectionFactory.createConnection();
    }
   
    protected void createSession() throws JMSException {
        session = connection.createSession(transacted, ackMode);
    }
View Full Code Here


    private void initializeRemote() throws JMSException {
        if (remoteConnection == null) {
            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(remoteUserName, remotePassword, uri);
            factory.setUseAsyncSend(true);
            remoteConnection = (ActiveMQConnection) factory.createConnection();
        }
        initializeRemoteConnection(remoteConnection);
    }

    private void initializeRemoteConnection(ActiveMQConnection connection) throws JMSException {
View Full Code Here

    private void initializeLocal() throws JMSException {
        String brokerName = brokerContainer.getBroker().getBrokerName();
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://" + brokerName);
        factory.setUseAsyncSend(true);
        factory.setBrokerName(brokerName);
        localConnection = (ActiveMQConnection) factory.createConnection();
        localConnection.setJ2EEcompliant(false);
        localConnection.start();
        BrokerInfo info = new BrokerInfo();
        info.setBrokerName(remoteBrokerName);
        info.setClusterName(remoteClusterName);
View Full Code Here

        // TODO remove this hack!
        //Connection dummy = connectionFactory.createConnection();
        //dummy.start();

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

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

        connection.close();
        connection = null;

        // now create a new Connection, Session &  Producer, send some messages & then close
        connection = connectionFactory.createConnection();
        // connection.setClientID(clientID); // this should not be required for the Producer
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        topic = session.createTopic(topicName);
        MessageProducer producer = session.createProducer(topic);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
View Full Code Here

        connection = null;

        // Now (re)register the Durable subscriber, setup a listener and wait for messages that should
        // have been published by the previous producer

        connection = connectionFactory.createConnection();
        connection.setClientID(clientID);
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        topic = session.createTopic(topicName);

        subscriber = session.createDurableSubscriber(topic, subscriberName);
View Full Code Here

    }

    protected Connection createConnection() throws Exception {
        ActiveMQConnectionFactory factory = createConnectionFactory();
        return factory.createConnection();
    }

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        return new ActiveMQConnectionFactory(broker, "tcp://localhost:61623");
    }
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

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

        // stop activemq broker
        container.stop();

    }
View Full Code Here

        // use an embedded broker configured via Spring
        connectionFactory.setUseEmbeddedBroker(true);
        connectionFactory.setBrokerContainerFactory(new SpringBrokerContainerFactory(new ClassPathResource("org/codehaus/activemq/usecases/receiver-zeroconf.xml")));

        Connection connection = connectionFactory.createConnection();
        connection.setClientID("Producer1");
        connection.start();

        // now lets close things down
        connection.close();
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.