Package org.apache.activemq

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


    public void testPoisonOnDeliveryWhilePending() throws Exception {
        LOG.info("testPoisonOnDeliveryWhilePending()");
        broker = createBroker(true);
        broker.start();
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")?jms.consumerFailoverRedeliveryWaitPeriod=10000");
        Connection connection = cf.createConnection();
        connection.start();
        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME + "?consumer.prefetchSize=0");
        final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
        MessageConsumer consumer = consumerSession.createConsumer(destination);
View Full Code Here


        assertEquals("persistence adapter dataManager has correct number of files", 2, asyncDataManager.getFiles().size());
    }

    private Connection createConnection() throws JMSException {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
        return factory.createConnection();
    }

    private void startBroker() throws Exception {
        broker = new BrokerService();
        broker.setDeleteAllMessagesOnStartup(true);
View Full Code Here

       
        public void testLoadedSendRecieveWithCorrelationId() throws Exception {           
          
            ActiveMQConnectionFactory connectionFactory = new org.apache.activemq.ActiveMQConnectionFactory();
            connectionFactory.setBrokerURL(BROKER_URL);
            Connection connection = connectionFactory.createConnection();         
            setupReceiver(connection);

            connection = connectionFactory.createConnection();
            connection.start();
           
View Full Code Here

            ActiveMQConnectionFactory connectionFactory = new org.apache.activemq.ActiveMQConnectionFactory();
            connectionFactory.setBrokerURL(BROKER_URL);
            Connection connection = connectionFactory.createConnection();         
            setupReceiver(connection);

            connection = connectionFactory.createConnection();
            connection.start();
           
            // trival session/producer pool  
            for (int i=0; i<NUM_THREADS; i++) {
                sessions[i] = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        // now lets try again without one connection open
        consumeMessagesDeliveredWhileConsumerClosed();
        // now delete the db
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=true");
        dummyConnection = fac.createConnection();
        dummyConnection.start();
        dummyConnection.close();
    }

    protected void consumeMessagesDeliveredWhileConsumerClosed() throws Exception {
View Full Code Here

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerUrl);
        Connection connection = null;
        try {

            connection = cf.createConnection(userName,password);
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(dest);
            ActiveMQTextMessage msg = (ActiveMQTextMessage)session.createTextMessage(body);

            for (Iterator iter = headers.entrySet().iterator(); iter.hasNext();) {
View Full Code Here

    public void testStartBrokerUsingXmlConfig() throws Exception {
        Connection connection = null;
        try {
            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
            connection = connectionFactory.createConnection();
            connection.start();
            connection.close();
            connection = null;
        } catch (Exception e) {
            if (connection != null) {
View Full Code Here

    }

    public void testMessageDelivery() throws Exception {

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        Connection connection = factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        ActiveMQResourceAdapter adapter = new ActiveMQResourceAdapter();
        adapter.setServerUrl("vm://localhost?broker.persistent=false");
        adapter.start(new StubBootstrapContext());
View Full Code Here

        // Setup the consumers
        MessageConsumer info;
        MessageConsumer debug;
        MessageConsumer warn;
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
        Connection conn = factory.createConnection();
        conn.start();

        warn = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.WARN"));
        info = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.INFO"));
        debug = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.DEBUG"));
View Full Code Here

        } else {
            if (activationSpec.isDurableSubscription()) {
                log.warn("No clientID specified for durable subscription: " + activationSpec);
            }
        }
        ActiveMQConnection physicalConnection = (ActiveMQConnection) cf.createConnection(userName, password);

        // have we configured a redelivery policy
        RedeliveryPolicy redeliveryPolicy = activationSpec.redeliveryPolicy();
        if (redeliveryPolicy != null) {
            physicalConnection.setRedeliveryPolicy(redeliveryPolicy);
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.