private void doCreateBroker(boolean memoryLimit, int expireMessagesPeriod) throws Exception { broker = new BrokerService(); broker.setBrokerName("localhost"); broker.setUseJmx(true); broker.setDeleteAllMessagesOnStartup(true); broker.addConnector("tcp://localhost:0"); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setOptimizedDispatch(optimizedDispatch); defaultEntry.setExpireMessagesPeriod(expireMessagesPeriod); 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); broker.start(); broker.waitUntilStarted(); connectionUri = broker.getTransportConnectors().get(0).getPublishableConnectString(); }
@Before public void startBroker() throws Exception { brokerService = new BrokerService(); TestSupport.setPersistenceAdapter(brokerService, persistenceAdapterChoice); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setUseJmx(false); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setUseConsumerPriority( false); // java.lang.IllegalArgumentException: Comparison method violates its general // contract! defaultEntry.setMaxAuditDepth(publisherThreadCount); defaultEntry.setEnableAudit(true); defaultEntry.setUseCache(useCache); defaultEntry.setMaxPageSize(1000); defaultEntry.setOptimizedDispatch(optimizeDispatch); defaultEntry.setMemoryLimit(destMemoryLimit); defaultEntry.setExpireMessagesPeriod(0); policyMap.setDefaultEntry(defaultEntry); brokerService.setDestinationPolicy(policyMap); brokerService.getSystemUsage().getMemoryUsage().setLimit(512 * 1024 * 1024); TransportConnector transportConnector = brokerService.addConnector("tcp://0.0.0.0:0"); brokerService.start(); activemqURL = transportConnector.getPublishableConnectString(); }
protected void configureBroker(BrokerService brokerService) throws Exception { setPersistentAdapter(brokerService); brokerService.setAdvisorySupport(false); PolicyMap map = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setMemoryLimit(1024 * 3); defaultEntry.setCursorMemoryHighWaterMark(68); defaultEntry.setExpireMessagesPeriod(0); map.setDefaultEntry(defaultEntry); brokerService.setDestinationPolicy(map); }
protected BrokerService createBroker() throws Exception { BrokerService service = new BrokerService(); service.setPersistent(false); service.setUseJmx(false); PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setUseConsumerPriority(true); policyMap.setDefaultEntry(policy); service.setDestinationPolicy(policyMap); connector = service.addConnector("tcp://localhost:0"); return service; }
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(new SimpleDispatchPolicy()); policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy()); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
// helper method to create a broker with slow consumer advisory turned on private BrokerService createBroker() throws Exception { BrokerService broker = new BrokerService(); broker.setBrokerName("localhost"); broker.setUseJmx(true); broker.setDeleteAllMessagesOnStartup(true); broker.addConnector("vm://localhost"); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setAdvisoryForSlowConsumers(true); policyMap.setDefaultEntry(defaultEntry); broker.setDestinationPolicy(policyMap); broker.start(); broker.waitUntilStarted(); return broker; }