Package org.activemq

Examples of org.activemq.ActiveMQConnectionFactory


        }
    }

   
    protected ActiveMQConnectionFactory createReceiverConnectionFactory() throws JMSException {
        ActiveMQConnectionFactory fac =  new ActiveMQConnectionFactory(receiverBroker, "tcp://localhost:62002");
        fac.setUseEmbeddedBroker(false);
        return fac;
    }
View Full Code Here


        fac.setUseEmbeddedBroker(false);
        return fac;
    }

    protected ActiveMQConnectionFactory createSenderConnectionFactory() throws JMSException {
        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory(senderBroker, "tcp://localhost:62001");
        fac.setUseEmbeddedBroker(false);
        return fac;
    }
View Full Code Here

            assertMessagesReceivedAreValid(messageLists[i]);
        }
    }

    protected ActiveMQConnectionFactory createConnectionFactory() {
        return new ActiveMQConnectionFactory("vm://localhost");
    }
View Full Code Here

* @version $Revision: 1.1.1.1 $
*/
public class SubscribeClosePublishThenConsumeTest extends TestSupport {

    public void testDurableTopic() throws Exception {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://locahost");
        connectionFactory.setUseEmbeddedBroker(true);

        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);

        // this should register a durable subscriber, we then close it to
        // test that we get messages from the producer later on
        TopicSubscriber subscriber = session.createDurableSubscriber(topic, subscriberName);
        connection.start();

        topic = null;
        subscriber.close();
        subscriber = null;
        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);
        MessageProducer producer = session.createProducer(topic);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
        TextMessage textMessage = session.createTextMessage("Hello World");
        producer.send(textMessage);
        textMessage = null;

        topic = null;
        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

        destination = createDestination(getClass().getName());
    }

    public ActiveMQConnectionFactory getConnectionFactory() throws Exception {
        String url = "reliable:" + ActiveMQConnection.DEFAULT_BROKER_URL;
        return new ActiveMQConnectionFactory(url);
    }
View Full Code Here

    private Connection connection;
    private Latch latch = new Latch();

    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

        assertTrue("No topic created!", topic != null);
    }

    public void testTryToReproduceNullPointerBug() throws Exception {
        String url = bindAddress;
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
        QueueConnection queueConnection = factory.createQueueConnection();
        this.connection = queueConnection;
        QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        QueueSender sender = session.createSender(null); //Unidentified
        Queue receiverQueue = session.createTemporaryQueue();
        QueueReceiver receiver = session.createReceiver(receiverQueue);
View Full Code Here

        }
        assertTrue("Unexpected count: " + count, count.get() == NUMBER);
    }

    protected QueueConnection createConnection() throws Exception {
        ActiveMQConnectionFactory factory = createConnectionFactory();
        return factory.createQueueConnection();
    }
View Full Code Here

        ActiveMQConnectionFactory factory = createConnectionFactory();
        return factory.createQueueConnection();
    }

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        return new ActiveMQConnectionFactory(bindAddress);
    }
View Full Code Here

        receiveBroker = new BrokerContainerImpl("receiver");
        receiveBroker.addConnector("tcp://localhost:62002");
        receiveBroker.addNetworkConnector("reliable:tcp://localhost:62001");
        receiveBroker.start();

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(receiveBroker, "tcp://localhost:62002");
        return factory;
    }
View Full Code Here

TOP

Related Classes of org.activemq.ActiveMQConnectionFactory

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.