Package org.apache.activemq.broker.region.policy

Examples of org.apache.activemq.broker.region.policy.PolicyEntry


        broker.setUseJmx(true);
        broker.setDeleteAllMessagesOnStartup(true);
        broker.addConnector("tcp://localhost:61616");

        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        defaultEntry.setOptimizedDispatch(optimizedDispatch );
        defaultEntry.setExpireMessagesPeriod(800);
        defaultEntry.setMaxExpirePageSize(800);
       
        defaultEntry.setPendingQueuePolicy(pendingQueuePolicy);

        if (memoryLimit) {
            // so memory is not consumed by DLQ turn if off
            defaultEntry.setDeadLetterStrategy(null);
            defaultEntry.setMemoryLimit(200 * 1000);
        }

        policyMap.setDefaultEntry(defaultEntry);
        broker.setDestinationPolicy(policyMap);

View Full Code Here


        networkConnector.setNetworkTTL(ttl);
        networkConnector.setSuppressDuplicateTopicSubscriptions(suppressDuplicateTopicSubs);

       
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry policy = new PolicyEntry();
        policy.setDispatchPolicy(dispatchPolicy);
        // the audit will suppress the duplicates as it defaults to true so this test
        // checking for dups will fail. it is good to have it on in practice.
        policy.setEnableAudit(false);
        policyMap.put(new ActiveMQTopic(TOPIC_NAME), policy);
        broker.setDestinationPolicy(policyMap);
        broker.start();
      
        return broker;
View Full Code Here

        brokerService.setPersistenceAdapter(adaptor);
        brokerService.deleteAllMessages();
       
        // A small max page size makes this issue occur faster.
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry pe = new PolicyEntry();
        pe.setMaxPageSize(1);
        policyMap.put(new ActiveMQQueue(">"), pe);
        brokerService.setDestinationPolicy(policyMap);
       
        brokerService.addConnector(ACTIVEMQ_BROKER_BIND);
        brokerService.start();
View Full Code Here

        BrokerService brokerService = new BrokerService();
        brokerService.setEnableStatistics(false);
        brokerService.addConnector("tcp://0.0.0.0:61616");
        brokerService.setDeleteAllMessagesOnStartup(true);

        PolicyEntry policy = new PolicyEntry();
        policy.setPrioritizedMessages(true);
        policy.setMaxPageSize(500);

        PolicyMap policyMap = new PolicyMap();
        policyMap.setDefaultEntry(policy);
        brokerService.setDestinationPolicy(policyMap);
View Full Code Here

    StompConnection stompConnection;
    URI tcpBrokerUri;
    URI stompBrokerUri;

    private PolicyEntry createPolicyEntry() {
        PolicyEntry policy = new PolicyEntry();
        policy.setAdvisdoryForFastProducers(true);
        policy.setAdvisoryForConsumed(true);
        policy.setAdvisoryForDelivery(true);
        policy.setAdvisoryForDiscardingMessages(true);
        policy.setAdvisoryForSlowConsumers(true);
        policy.setAdvisoryWhenFull(true);
        policy.setProducerFlowControl(false);

        ConstantPendingMessageLimitStrategy strategy = new ConstantPendingMessageLimitStrategy();
        strategy.setLimit(10);
        policy.setPendingMessageLimitStrategy(strategy);
        return policy;
    }
View Full Code Here

    protected BrokerService createBroker() throws Exception {
        BrokerService broker = BrokerFactory.createBroker(new URI("broker://()/localhost?useJmx=false"));

        broker.setPersistent(false);
        PolicyEntry policy = new PolicyEntry();
        policy.setAdvisdoryForFastProducers(true);
        policy.setAdvisoryForConsumed(true);
        policy.setAdvisoryForDelivery(true);
        policy.setAdvisoryForDiscardingMessages(true);
        policy.setAdvisoryForSlowConsumers(true);
        policy.setAdvisoryWhenFull(true);
        policy.setProducerFlowControl(false);
        ConstantPendingMessageLimitStrategy strategy  = new ConstantPendingMessageLimitStrategy();
        strategy.setLimit(10);
        policy.setPendingMessageLimitStrategy(strategy);
        PolicyMap pMap = new PolicyMap();
        pMap.setDefaultEntry(policy);

        broker.setDestinationPolicy(pMap);
        broker.setDeleteAllMessagesOnStartup(true);
View Full Code Here

    }

    public void testPrefetchViaBrokerConfig() throws Exception {

        Integer prefetchVal = new Integer(150);
        PolicyEntry policyEntry = new PolicyEntry();
        policyEntry.setDurableTopicPrefetch(prefetchVal.intValue());
        policyEntry.setPrioritizedMessages(true);
        PolicyMap policyMap = new PolicyMap();
        policyMap.setDefaultEntry(policyEntry);
        broker.setDestinationPolicy(policyMap);
        broker.start();
View Full Code Here

        KahaDBStore kaha = new KahaDBStore();
        kaha.setDirectory(dataFileDir);
        answer.setUseJmx(false);
     // Setup a destination policy where it takes only 1 message at a time.
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry policy = new PolicyEntry();
        policy.setOptimizedDispatch(true);
        policyMap.setDefaultEntry(policy);
        answer.setDestinationPolicy(policyMap);
       
        answer.setAdvisorySupport(false);
        answer.setEnableStatistics(false);
View Full Code Here

    }

    private void configureBroker(BrokerService broker) {
        broker.setUseJmx(false);
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        defaultEntry.setOptimizedDispatch(true);
        policyMap.setDefaultEntry(defaultEntry);
        // optimized dispatch does not effect the determinism of inflight between
        // master and slave in this test
        //broker.setDestinationPolicy(policyMap);
       
View Full Code Here

        // Setup the destination policy
        PolicyMap pm = new PolicyMap();

        // Setup the topic destination policy
        PolicyEntry tpe = new PolicyEntry();
        tpe.setTopic(">");
        tpe.setMemoryLimit(destinationMemLimit);
        tpe.setProducerFlowControl(true);

        // Setup the topic destination policy
        PolicyEntry qpe = new PolicyEntry();
        qpe.setQueue(">");
        qpe.setMemoryLimit(destinationMemLimit);
        qpe.setProducerFlowControl(true);
        qpe.setQueuePrefetch(1);

        pm.setPolicyEntries(Arrays.asList(new PolicyEntry[]{tpe, qpe}));

        broker.setDestinationPolicy(pm);
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.policy.PolicyEntry

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.