Package org.apache.activemq

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


        broker.waitUntilStarted();

        stompConnect();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(jmsUri);
        connection = cf.createConnection("system", "manager");
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        queue = new ActiveMQQueue(getDestinationName());
        connection.start();

        executor = Executors.newFixedThreadPool(TASK_COUNT, new ThreadFactory() {
View Full Code Here


        final String stompUri = broker.getConnectorByName("Stomp").getPublishableConnectString();
        final int stompPort = new URI(stompUri).getPort();
        final String openwireUri = broker.getConnectorByName("Default").getPublishableConnectString();

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(openwireUri);
        Connection connection = factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(new ActiveMQQueue(getDestinationName()));
        Message message = session.createTextMessage("Testas");
        for (int idx = 0; idx < 2000; ++idx) {
            producer.send(message);
View Full Code Here

        NetworkConnector networkConnector = broker.addNetworkConnector("static:(tcp://wrongHostname1:61617,tcp://wrongHostname2:61618)?useExponentialBackOff=false");
        networkConnector.setDuplex(true);
        broker.start();
       
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(new URI(VM_BROKER_URI));
        Connection connection = cf.createConnection("system", "manager");
        connection.start();
       
        // let it settle
        TimeUnit.SECONDS.sleep(5);
       
View Full Code Here

        broker.setPersistent(false);
        broker.addConnector("tcp://localhost:61616?wireFormat.maxInactivityDuration=1000&wireFormat.maxInactivityDurationInitalDelay=1000");
        broker.start();

        cf = new ActiveMQConnectionFactory("tcp://localhost:61616?wireFormat.maxInactivityDuration=1000&wireFormat.maxInactivityDurationInitalDelay=1000");
        connection = cf.createConnection("system", "manager");
        connection.start();
        connection.close();
        broker.stop();
        broker.waitUntilStopped();
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

    }
   
    protected void setUp() throws Exception {
        broker = createBroker();
        ConnectionFactory factory = new ActiveMQConnectionFactory(broker.getTransportConnectorURIsAsMap().get("tcp"));
        connection = factory.createConnection();
        connection.start();
    }
   
    protected void tearDown() throws Exception{
        if (this.connection != null) {
View Full Code Here

        TransportConnector connector = broker.addConnector("nio+ssl://localhost:0?transport.needClientAuth=true&transport.enabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA,SSL_DH_anon_WITH_3DES_EDE_CBC_SHA");
        broker.start();
        broker.waitUntilStarted();

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("nio+ssl://localhost:" + connector.getConnectUri().getPort());
        connection = factory.createConnection();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        connection.start();
    }

    @Override
View Full Code Here

    public void testNetworkFailback() throws Exception {
        final long timeout = 5000; // 5 seconds
        final String queueName = getClass().getName();

        ActiveMQConnectionFactory factoryA = new ActiveMQConnectionFactory(clientUrlA);
        ActiveMQConnection connectionA = (ActiveMQConnection) factoryA.createConnection();
        connectionA.start();
        Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queueA = sessionA.createQueue(queueName);
        MessageProducer producerA = sessionA.createProducer(queueA);
View Full Code Here

        Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queueA = sessionA.createQueue(queueName);
        MessageProducer producerA = sessionA.createProducer(queueA);

        ActiveMQConnectionFactory factoryB = new ActiveMQConnectionFactory(clientUrlB);
        ActiveMQConnection connectionB = (ActiveMQConnection) factoryB.createConnection();
        connectionB.start();
        Session sessionB = connectionB.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queueB = sessionB.createQueue(queueName);
        MessageConsumer consumerB = sessionA.createConsumer(queueB);
View Full Code Here

        IOHelper.deleteFile(dir);
        kaha.setDirectory(dir);
        kaha.setJournalMaxFileLength(1024*1024);
        BrokerService broker = createBroker(kaha);
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");       
        Connection connection = cf.createConnection();
        connection.setClientID("test");
        connection.start();
        producerSomeMessages(connection, 1000);
        connection.close();
        broker.stop();
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.