Package org.apache.activemq.broker

Examples of org.apache.activemq.broker.ProgressPrinter


    }
   
    public void testQueueSendThenAddConsumer() throws Exception {
        int MESSAGE_SIZE=1024*64;
        int PRODUCE_COUNT=10000;
        ProgressPrinter printer = new ProgressPrinter(PRODUCE_COUNT, 20);
  
        ActiveMQDestination destination = new ActiveMQQueue("TEST");
       
        connection.setUseCompression(false);
        connection.getPrefetchPolicy().setAll(10);
        connection.start();
        Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);

        log.info("Sending "+ PRODUCE_COUNT+" messages that are "+(MESSAGE_SIZE/1024.0)+"k large, for a total of "+(PRODUCE_COUNT*MESSAGE_SIZE/(1024.0*1024.0))+" megs of data.");
        // Send a message to the broker.
        long start = System.currentTimeMillis();
        for( int i=0; i < PRODUCE_COUNT; i++) {
            printer.increment();
            BytesMessage  msg = session.createBytesMessage();
            msg.writeBytes(new byte[MESSAGE_SIZE]);
            producer.send(msg);
        }
        long end1 = System.currentTimeMillis();
       
        log.info("Produced messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));
       
        printer = new ProgressPrinter(PRODUCE_COUNT, 10);
        start = System.currentTimeMillis();
        MessageConsumer consumer = session.createConsumer(destination);
        for( int i=0; i < PRODUCE_COUNT; i++) {
            printer.increment();
            assertNotNull("Getting message: "+i,consumer.receive(20000));
        }
        end1 = System.currentTimeMillis();
        log.info("Consumed messages/sec: "+ (PRODUCE_COUNT*1000.0/(end1-start)));
       
View Full Code Here


        factory.setUseAsyncSend(true);
        return factory;
    }

    public void testQueueSendThenAddConsumer() throws Exception {
        ProgressPrinter printer = new ProgressPrinter(produceCount, 20);

        ActiveMQDestination destination = new ActiveMQQueue("TEST");

        connection.setUseCompression(false);
        connection.getPrefetchPolicy().setAll(10);
        connection.start();
        Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);

        LOG.info("Sending " + produceCount + " messages that are " + (messageSize / 1024.0) + "k large, for a total of " + (produceCount * messageSize / (1024.0 * 1024.0))
                 + " megs of data.");
        // Send a message to the broker.
        long start = System.currentTimeMillis();
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            BytesMessage msg = session.createBytesMessage();
            msg.writeBytes(new byte[messageSize]);
            producer.send(msg);
        }
        long end1 = System.currentTimeMillis();

        LOG.info("Produced messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

        printer = new ProgressPrinter(produceCount, 10);
        start = System.currentTimeMillis();
        MessageConsumer consumer = session.createConsumer(destination);
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            assertNotNull("Getting message: " + i, consumer.receive(20000));
        }
        end1 = System.currentTimeMillis();
        LOG.info("Consumed messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

View Full Code Here

        factory.setUseAsyncSend(true);
        return factory;
    }

    public void testQueueSendThenAddConsumer() throws Exception {
        ProgressPrinter printer = new ProgressPrinter(produceCount, 20);

        ActiveMQDestination destination = new ActiveMQQueue("TEST");

        connection.setUseCompression(false);
        connection.getPrefetchPolicy().setAll(10);
        connection.start();
        Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);

        LOG.info("Sending " + produceCount + " messages that are " + (messageSize / 1024.0) + "k large, for a total of " + (produceCount * messageSize / (1024.0 * 1024.0))
                 + " megs of data.");
        // Send a message to the broker.
        long start = System.currentTimeMillis();
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            BytesMessage msg = session.createBytesMessage();
            msg.writeBytes(new byte[messageSize]);
            producer.send(msg);
        }
        long end1 = System.currentTimeMillis();

        LOG.info("Produced messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

        printer = new ProgressPrinter(produceCount, 10);
        start = System.currentTimeMillis();
        MessageConsumer consumer = session.createConsumer(destination);
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            assertNotNull("Getting message: " + i, consumer.receive(20000));
        }
        end1 = System.currentTimeMillis();
        LOG.info("Consumed messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

View Full Code Here

        factory.setUseAsyncSend(true);
        return factory;
    }

    public void testQueueSendThenAddConsumer() throws Exception {
        ProgressPrinter printer = new ProgressPrinter(produceCount, 20);

        ActiveMQDestination destination = new ActiveMQQueue("TEST");

        connection.setUseCompression(false);
        connection.getPrefetchPolicy().setAll(10);
        connection.start();
        Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);

        LOG.info("Sending " + produceCount + " messages that are " + (messageSize / 1024.0) + "k large, for a total of " + (produceCount * messageSize / (1024.0 * 1024.0))
                 + " megs of data.");
        // Send a message to the broker.
        long start = System.currentTimeMillis();
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            BytesMessage msg = session.createBytesMessage();
            msg.writeBytes(new byte[messageSize]);
            producer.send(msg);
        }
        long end1 = System.currentTimeMillis();

        LOG.info("Produced messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

        printer = new ProgressPrinter(produceCount, 10);
        start = System.currentTimeMillis();
        MessageConsumer consumer = session.createConsumer(destination);
        for (int i = 0; i < produceCount; i++) {
            printer.increment();
            assertNotNull("Getting message: " + i, consumer.receive(20000));
        }
        end1 = System.currentTimeMillis();
        LOG.info("Consumed messages/sec: " + (produceCount * 1000.0 / (end1 - start)));

View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.ProgressPrinter

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.