Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQPrefetchPolicy


    @Override
    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {

        connectionFactory = new ActiveMQConnectionFactory("vm://" + getName(true));

        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setAll(10);
        connectionFactory.setPrefetchPolicy(prefetchPolicy);

        connectionFactory.setWatchTopicAdvisories(false);
        return connectionFactory;
    }
View Full Code Here


        broker.setDestinationPolicy(policyMap);
        broker.start();
        broker.waitUntilStarted();

        factory = new ActiveMQConnectionFactory("vm://priorityTest");
        ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
        prefetch.setAll(prefetchVal);
        factory.setPrefetchPolicy(prefetch);
        factory.setWatchTopicAdvisories(false);
        factory.setDispatchAsync(dispatchAsync);
        conn = factory.createConnection();
        conn.setClientID("priority");
View Full Code Here

    }

    public void testHighPriorityDelivery() throws Exception {

        // get zero prefetch
        ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
        prefetch.setAll(0);
        factory.setPrefetchPolicy(prefetch);
        conn.close();
        conn = factory.createConnection();
        conn.setClientID("priority");
        conn.start();
View Full Code Here

    }

    public void testHighPriorityDeliveryInterleaved() throws Exception {

        // get zero prefetch
        ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
        prefetch.setAll(0);
        factory.setPrefetchPolicy(prefetch);
        conn.close();
        conn = factory.createConnection();
        conn.setClientID("priority");
        conn.start();
View Full Code Here

    }

    public void testHighPriorityDeliveryThroughBackLog() throws Exception {

        // get zero prefetch
        ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
        prefetch.setAll(0);
        factory.setPrefetchPolicy(prefetch);
        conn.close();
        conn = factory.createConnection();
        conn.setClientID("priority");
        conn.start();
View Full Code Here

    }

    public void testHighPriorityNonDeliveryThroughBackLog() throws Exception {

        // get zero prefetch
        ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
        prefetch.setAll(0);
        factory.setPrefetchPolicy(prefetch);
        conn.close();
        conn = factory.createConnection();
        conn.setClientID("priority");
        conn.start();
View Full Code Here

        numberOfMessages + " messages per publisher, and " +
        numberOfQueues + " queues.");
   
    ConnectionFactory connectionFactory;

    ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
    prefetch.setQueuePrefetch(1);
    ActiveMQConnectionFactory  amq = new ActiveMQConnectionFactory(url);
    amq.setPrefetchPolicy(prefetch);
   
    connectionFactory = new PooledConnectionFactory(amq);
    ((PooledConnectionFactory)connectionFactory).setMaxConnections(5);
View Full Code Here

    }

    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
            broker.getTransportConnectors().get(0).getPublishableConnectString());
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setAll(1);
        factory.setPrefetchPolicy(prefetchPolicy);

        factory.setDispatchAsync(true);
        return factory;
    }
View Full Code Here

               
        Topic advisoryTopic = AdvisorySupport.getMessageDiscardedAdvisoryTopic((ActiveMQDestination) topic);
        MessageConsumer advisoryConsumer = s.createConsumer(advisoryTopic);
        //start throwing messages at the consumer
        MessageProducer producer = s.createProducer(topic);
        int count = (new ActiveMQPrefetchPolicy().getTopicPrefetch() * 2);
        for (int i = 0; i < count; i++) {
            BytesMessage m = s.createBytesMessage();
            producer.send(m);
        }
               
View Full Code Here

        // URI failoverURI = new
        // URI("failover://"+remoteConnector.getServer().getConnectURI());
        URI failoverURI = new URI("failover://tcp://localhost:61616");

        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(failoverURI);
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();

        // Prefetch size must be less than messages in the queue!!
        prefetchPolicy.setQueuePrefetch(MSG_COUNT - 10);
        factory.setPrefetchPolicy(prefetchPolicy);
        Connection connection = factory.createConnection();
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(new ActiveMQQueue("Test"));
        for (int idx = 0; idx < MSG_COUNT; ++idx) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.ActiveMQPrefetchPolicy

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.