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

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


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

    protected PolicyEntry getDefaultPolicy() {
        PolicyEntry policy = new PolicyEntry();
        policy.setDispatchPolicy(new RoundRobinDispatchPolicy());
        policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy());
        return policy;
    }
View Full Code Here


        bindAddress = answer.getTransportConnectors().get(0).getConnectUri().toString();
        return answer;
    }
   
    protected void configureBroker(BrokerService answer) throws Exception {
        PolicyEntry policy = new PolicyEntry();
        policy.setMemoryLimit(QUEUE_MEMORY_LIMIT);
        policy.setPendingQueuePolicy(new StorePendingQueueMessageStoragePolicy());
       
        // disable the cache to be sure setBatch is the problem
        // will get lots of duplicates
        // real problem is sync between cursor and store add - leads to out or order messages
        // in the cursor so setBatch can break.
View Full Code Here

       
        // Setup a destination policy where it takes lots of message at a time.
        // so that slave does not block first as there is no producer flow control
        // on the master connector
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry policy = new PolicyEntry();
        // don't apply the same memory limit as the master in this case
        //policy.setMemoryLimit(10);
        policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
        policy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
        policy.setProducerFlowControl(true);
        policyMap.setDefaultEntry(policy);
       
        slave.setDestinationPolicy(policyMap);
        slave.setMasterConnectorURI(connector.getConnectUri().toString());
        slave.start();
View Full Code Here

        //persistent = true;
        BrokerService broker = new BrokerService();
        broker.setDeleteAllMessagesOnStartup(true);
        broker.addConnector("tcp://localhost:0");
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        defaultEntry.setPendingQueuePolicy(new FilePendingQueueMessageStoragePolicy());
        defaultEntry.setCursorMemoryHighWaterMark(50);
        defaultEntry.setMemoryLimit(500*1024);
        defaultEntry.setProducerFlowControl(false);
        policyMap.setDefaultEntry(defaultEntry);
        broker.setDestinationPolicy(policyMap);

        broker.getSystemUsage().getMemoryUsage().setLimit(1000 * 1024);

 
View Full Code Here

        answer.setDeleteAllMessagesOnStartup(true);
        answer.setUseJmx(true);
      
        // apply memory limit so that %usage is visible
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        defaultEntry.setMemoryLimit(1024*1024*4);
        policyMap.setDefaultEntry(defaultEntry);
        answer.setDestinationPolicy(policyMap);
       
        answer.addConnector(bindAddress);
        return answer;
View Full Code Here

    }

    protected BrokerService createBroker() throws Exception {
        BrokerService answer = super.createBroker();
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        // ensure prefetch is exact. only delivery next when current is acked
        defaultEntry.setUsePrefetchExtension(false);
        policyMap.setDefaultEntry(defaultEntry);
        answer.setDestinationPolicy(policyMap);
        return answer;
    }
View Full Code Here

    @Override
    protected BrokerService createBroker() throws Exception {
        BrokerService broker = super.createBroker();
        broker.setDestinations(new ActiveMQDestination[] {queue});
        broker.setSchedulePeriodForDestinationPurge(1000);
        PolicyEntry entry = new PolicyEntry();
        entry.setGcInactiveDestinations(true);
        entry.setInactiveTimoutBeforeGC(3000);
        PolicyMap map = new PolicyMap();
        map.setDefaultEntry(entry);
        broker.setDestinationPolicy(map);
        return broker;
    }
View Full Code Here

        StoreUsage storeUsage = new StoreUsage();
        storeUsage.setLimit((1024 * 1024) * 38);
        TempUsage tmpUsage = new TempUsage();
        tmpUsage.setLimit((1024 * 1024) * 38);

        PolicyEntry defaultPolicy = new PolicyEntry();
        // defaultPolicy.setTopic("FooTwo");
        defaultPolicy.setProducerFlowControl(false);
        defaultPolicy.setMemoryLimit(10 * 1024);

        PolicyMap policyMap = new PolicyMap();
        policyMap.setDefaultEntry(defaultPolicy);

        sysUsage.setMemoryUsage(memUsage);
View Full Code Here

        assertTrue("cache is enabled again on next send when there are no messages", proxy.isCacheEnabled());
    }

    private void applyBrokerSpoolingPolicy() {
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry defaultEntry = new PolicyEntry();
        defaultEntry.setProducerFlowControl(false);
        PendingQueueMessageStoragePolicy pendingQueuePolicy = new FilePendingQueueMessageStoragePolicy();
        defaultEntry.setPendingQueuePolicy(pendingQueuePolicy);
        policyMap.setDefaultEntry(defaultEntry);
        broker.setDestinationPolicy(policyMap);
    }
View Full Code Here

        KahaDBPersistenceAdapter kahaDb = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        kahaDb.setConcurrentStoreAndDispatchQueues(false);
        broker.addConnector("tcp://0.0.0.0:2401");
        PolicyMap policies = new PolicyMap();
        PolicyEntry entry = new PolicyEntry();
        entry.setMemoryLimit(1024 * 1024);
        entry.setProducerFlowControl(true);
        if (useVMCursor) {
            entry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
        }
        entry.setQueue(">");
        policies.setDefaultEntry(entry);
        broker.setDestinationPolicy(policies);
        broker.start();
        broker.waitUntilStarted();

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.