Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQPrefetchPolicy


        connectionFactory.setUseCompression(false);
        connectionFactory.setDispatchAsync(false);
        connectionFactory.setUseAsyncSend(false);
        connectionFactory.setOptimizeAcknowledge(false);
        connectionFactory.setWatchTopicAdvisories(true);
        ActiveMQPrefetchPolicy qPrefetchPolicy= new ActiveMQPrefetchPolicy();
        qPrefetchPolicy.setQueuePrefetch(100);
        qPrefetchPolicy.setTopicPrefetch(1000);
        connectionFactory.setPrefetchPolicy(qPrefetchPolicy);
        connectionFactory.setAlwaysSyncSend(true);
        return connectionFactory;
    }
View Full Code Here


        throws Exception
    {
        // Create the connection to the broker.
        ActiveMQConnectionFactory connectionFactory =
                new ActiveMQConnectionFactory(CONNECTION_URL);
        ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
        prefetchPolicy.setQueuePrefetch(QUEUE_PREFETCH_SIZE);
        connectionFactory.setPrefetchPolicy(prefetchPolicy);
        Connection connection = connectionFactory.createConnection();
        connection.start();

        Session masterSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        connectionFactory.setUseCompression(false);
        connectionFactory.setDispatchAsync(true);
        connectionFactory.setUseAsyncSend(false);
        connectionFactory.setOptimizeAcknowledge(false);
        connectionFactory.setWatchTopicAdvisories(false);
        ActiveMQPrefetchPolicy qPrefetchPolicy= new ActiveMQPrefetchPolicy();
        qPrefetchPolicy.setQueuePrefetch(100);
        qPrefetchPolicy.setTopicPrefetch(1000);
        connectionFactory.setPrefetchPolicy(qPrefetchPolicy);
        connectionFactory.setAlwaysSyncSend(true);
    return connectionFactory.createConnection();
  }
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

        ActiveMQConnectionFactory factoryB;
        factoryA = (ActiveMQConnectionFactory)getConnectionFactory("BrokerA");
        factoryB = (ActiveMQConnectionFactory)getConnectionFactory("BrokerB");

        // Set prefetch policy
        ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
        policy.setAll(PREFETCH_COUNT);

        factoryA.setPrefetchPolicy(policy);
        factoryB.setPrefetchPolicy(policy);

        msgsClient1 = 0;
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

        if (producerBroker == null) {
            producerBroker = createProducerBroker(producerBindAddress);
        }
        consumerFactory = createConnectionFactory(consumerBindAddress);
        consumerFactory.setDispatchAsync(true);
        ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
        policy.setQueuePrefetch(100);
        consumerFactory.setPrefetchPolicy(policy);
        producerFactory = createConnectionFactory(producerBindAddress);
        Connection con = consumerFactory.createConnection();
        Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
       
View Full Code Here

        return broker;
    }

    protected ActiveMQConnectionFactory createConnectionFactory(String uri) throws Exception {
        ActiveMQConnectionFactory result = super.createConnectionFactory(uri);
        ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
        policy.setTopicPrefetch(10);
        result.setPrefetchPolicy(policy);
        return result;
    }
View Full Code Here

     * Returns the prefetch policy; not using bean properties to avoid breaking
     * compatibility with JCA configuration in J2EE
     */
    public ActiveMQPrefetchPolicy prefetchPolicy() {
        if (prefetchPolicy == null) {
            prefetchPolicy = new ActiveMQPrefetchPolicy();
        }
        return prefetchPolicy;
    }
View Full Code Here

    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

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.