Package org.codehaus.activemq

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


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

        // stop activemq broker
        container.stop();

    }
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

        // 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

    protected void setUp() throws Exception {
        brokerUrl = "tcp://localhost:6099";
        subject = this.getClass().getName();
        String url = "peer://" + brokerUrl;
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory(url);
        brokerConnection = fac.createConnection();
        brokerConnection.start();
    }

    protected void tearDown() throws Exception {
        if (brokerConnection != null) {
View Full Code Here

    }

    protected Connection createConnection() throws JMSException {
        System.err.println("creating connection ....");
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("peer://" + getClass().getName());
        return fac.createConnection();
    }

    protected Destination createDestination() {
        return createDestination(getClass().getName());
    }
View Full Code Here

        remoteBroker = new BrokerContainerImpl("remoteBroker");
        remoteBroker.addConnector(ActiveMQConnection.DEFAULT_URL);
        remoteBroker.start();
       
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("remote://" + URL + "?brokerName=receiver");
        receiver = fac.createConnection();
        receiver.setClientID(new IdGenerator().generateId());
        receiver.start();
        Session s = receiver.createSession(false,Session.AUTO_ACKNOWLEDGE);
        Topic destination = s.createTopic(getClass().getName());
        consumer = s.createDurableSubscriber(destination, destination.toString());
View Full Code Here

        receiver.start();
        Session s = receiver.createSession(false,Session.AUTO_ACKNOWLEDGE);
        Topic destination = s.createTopic(getClass().getName());
        consumer = s.createDurableSubscriber(destination, destination.toString());
        fac = new ActiveMQConnectionFactory("remote://" + URL + "?brokerName=sender");
        sender = fac.createConnection();
        sender.start();
        senderSession = sender.createSession(false,Session.AUTO_ACKNOWLEDGE);
        producer = senderSession.createProducer(destination);
       
    }
View Full Code Here

        return session;
    }

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

    protected void close(Connection connection, Session session) throws JMSException {
        // lets dump the stats
        dumpStats(connection);
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.