Package org.apache.activemq

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


    connection.close();
  }
 
  private ActiveMQTextMessage receiveTestMessage(ActiveMQConnectionFactory factory) throws JMSException {
    ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
    connection.start();
      Session session = connection.createSession(false, 0);
    MessageConsumer consumer = session.createConsumer(queue);
    ActiveMQTextMessage rc = (ActiveMQTextMessage) consumer.receive();
    connection.close();
    return rc;
View Full Code Here


        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setWatchTopicAdvisories(watchTopicAdvisories);
        cf.setDispatchAsync(false);
       
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();
       
        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME + "?consumer.prefetchSize=" + prefetch);
       
        final Session consumerSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setWatchTopicAdvisories(watchTopicAdvisories);
        cf.setDispatchAsync(false);

        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();

        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME
                + "?consumer.prefetchSize=" + prefetch);
       
View Full Code Here

        broker.start();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
        cf.setConsumerFailoverRedeliveryWaitPeriod(10000);
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();

        final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Queue destination = producerSession.createQueue(QUEUE_NAME);

        final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
View Full Code Here

    }

    private Message receiveMessage(ActiveMQConnectionFactory cf,
            Queue destination) throws Exception {
        final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
        connection.start();
        final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
        final MessageConsumer consumer = consumerSession.createConsumer(destination);
        Message msg = consumer.receive(5000);
        consumerSession.commit();
        connection.close();
View Full Code Here

        ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
       
        // send message to dlq immediately
        RedeliveryPolicy policy = connection.getRedeliveryPolicy();
        policy.setMaximumRedeliveries(0);       
        connection.start();
       
        Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
        ActiveMQQueue destination = new ActiveMQQueue("camelRedeliveryQ");
        MessageProducer producer = session.createProducer(destination);
       
View Full Code Here

    public void testFDSLeak() throws Exception {

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
        ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
        connection.start();

        int connections = 100;
        final long original = openFileDescriptorCount();
        LOG.info("FD count: " + original);
        final CountDownLatch done = new CountDownLatch(connections);
View Full Code Here

                public void run() {
                    ActiveMQConnection connection = null;
                    try {
                        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
                        connection = (ActiveMQConnection) factory.createConnection();
                        connection.start();
                    } catch (Exception e) {
                        LOG.debug(getStack(e));
                    } finally {
                        try {
                            connection.close();
View Full Code Here

        }
    }

    private ActiveMQConnection createConnection(ActiveMQConnectionFactory factory) throws Exception {
        ActiveMQConnection c =(ActiveMQConnection) factory.createConnection();
        c.start();
        return c;
    }

    private ActiveMQConnectionFactory createConnectionFactory(BrokerService brokerService) throws Exception {
        String target = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
View Full Code Here

            Session session = activeMQConnection.createSession(false,
                    Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(session
                    .createQueue(queueName));
            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
            activeMQConnection.start();
            for (int i = 0; i < 10000; i++) {
                TextMessage textMessage = session.createTextMessage();
                textMessage.setText(generateBody(1000));
                textMessage.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
                producer.send(textMessage);
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.