Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQConnection.start()


    }

    public void testNoScheduledRedeliveryOfExpired() throws Exception {
        startBroker(true);
        ActiveMQConnection consumerConnection = (ActiveMQConnection) createConnection();
        consumerConnection.start();
        Session consumerSession = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        MessageConsumer consumer = consumerSession.createConsumer(destination);
        sendMessage(1000);
        Message message = consumer.receive(1000);
        assertNotNull("got message", message);
View Full Code Here


        assertEquals("message matches", message.getStringProperty("data"), dlqMessage.getStringProperty("data"));
    }

    private void sendMessage(int timeToLive) throws Exception {
        ActiveMQConnection producerConnection = (ActiveMQConnection) createConnection();
        producerConnection.start();
        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = producerSession.createProducer(destination);
        if (timeToLive > 0) {
            producer.setTimeToLive(timeToLive);
        }
View Full Code Here

    public void testValidateRedeliveryFlagAfterRestart() throws Exception {

        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(" + broker.getTransportConnectors().get(0).getPublishableConnectString()
            + ")?jms.transactedIndividualAck=true");
        ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection();
        connection.start();

        populateDestination(10, queueName, connection);

        Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
        Destination destination = session.createQueue(queueName);
View Full Code Here

    public void testValidateRedeliveryFlagAfterRecovery() throws Exception {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString()
            + "?jms.transactedIndividualAck=true");
        ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection();
        connection.start();

        populateDestination(1, queueName, connection);

        Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
        Destination destination = session.createQueue(queueName);
View Full Code Here

        broker.start();

        connectionFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString()
            + "?jms.transactedIndividualAck=true");
        connection = (ActiveMQConnection) connectionFactory.createConnection();
        connection.start();

        session = connection.createSession(true, Session.SESSION_TRANSACTED);
        consumer = session.createConsumer(destination);
        msg = (TextMessage) consumer.receive(10000);
        assertNotNull("got the message again", msg);
View Full Code Here

            connection = (ActiveMQConnection)cf.createConnection(username, password);
        } else {
            connection = (ActiveMQConnection)cf.createConnection();
        }
        TestCase.assertNotNull(connection);
        connection.start();
        connection.stop();
    }

    @Test
    public void testOpenwireSSLWithUsernameAndPassword() throws Exception {
View Full Code Here

                }
            }
        }
        );

        connection.start();
    }
}
View Full Code Here

        ActiveMQQueue queue = new ActiveMQQueue("TEST");

        // Send the messages to the Queue.
        ActiveMQConnection producerConnection = (ActiveMQConnection) factory.createConnection();
        producerConnection.setUseAsyncSend(true);
        producerConnection.start();
        Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = producerSession.createProducer(queue);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);

        for (int i = 1; i <= messageToSend; i++) {
View Full Code Here

    private ActiveMQConnection createConnection() throws Exception {
        final String opts = "?jms.watchTopicAdvisories=false";
        ActiveMQConnection connection = (ActiveMQConnection)
                new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri() + opts).createConnection();
        connection.start();
        return connection;
    }

    private void createBroker(boolean allowRemoteAddressInMbeanNames) throws Exception {
        broker = new BrokerService();
View Full Code Here

        connection.close();
        ActiveMQConnectionFactory tcpFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString());
        ActiveMQConnection conn = (ActiveMQConnection) tcpFactory.createConnection("user", "password");
        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        conn.start();

        final int numDests = broker.getRegionBroker().getDestinations().length;
        for (int i=0; i<10; i++) {
            MessageProducer p = sess.createProducer(new ActiveMQQueue("USERS.PURGE." + i));
            p.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.