Java Code Examples for org.apache.activemq.broker.BrokerService#setSchedulePeriodForDestinationPurge()
The following examples show how to use
org.apache.activemq.broker.BrokerService#setSchedulePeriodForDestinationPurge() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckDuplicateMessagesOnDuplexTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void createLocalBroker() throws Exception { localBroker = new BrokerService(); localBroker.setBrokerName("LOCAL"); localBroker.setUseJmx(true); localBroker.setSchedulePeriodForDestinationPurge(5000); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); localBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local"); localBroker.setPersistenceAdapter(persistenceAdapter); List<TransportConnector> transportConnectors = new ArrayList<>(); DebugTransportFactory tf = new DebugTransportFactory(); TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539")); TransportConnector transportConnector = new TransportConnector(transport); transportConnector.setName("tc"); transportConnector.setAuditNetworkProducers(true); transportConnectors.add(transportConnector); localBroker.setTransportConnectors(transportConnectors); }
Example 2
Source File: CheckDuplicateMessagesOnDuplexTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void createRemoteBroker() throws Exception { remoteBroker = new BrokerService(); remoteBroker.setBrokerName("REMOTE"); remoteBroker.setUseJmx(true); remoteBroker.setSchedulePeriodForDestinationPurge(5000); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); remoteBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/remote"); remoteBroker.setPersistenceAdapter(persistenceAdapter); List<NetworkConnector> networkConnectors = new ArrayList<>(); DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector(); networkConnector.setName("to local"); // set maxInactivityDuration to 0, otherwise the broker restarts while you are in the debugger networkConnector.setUri(URI.create("static://(tcp://127.0.0.1:23539?wireFormat.maxInactivityDuration=0)")); networkConnector.setDuplex(true); //networkConnector.setNetworkTTL(5); //networkConnector.setDynamicOnly(true); networkConnector.setAlwaysSyncSend(true); networkConnector.setDecreaseNetworkConsumerPriority(false); networkConnector.setPrefetchSize(1); networkConnector.setCheckDuplicateMessagesOnDuplex(true); networkConnectors.add(networkConnector); remoteBroker.setNetworkConnectors(networkConnectors); }
Example 3
Source File: RequestReplyNoAdvisoryNetworkTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private BrokerService configureBroker(String brokerName) throws Exception { BrokerService broker = new BrokerService(); broker.setBrokerName(brokerName); broker.setAdvisorySupport(false); broker.setPersistent(false); broker.setUseJmx(false); broker.setSchedulePeriodForDestinationPurge(1000); broker.setAllowTempAutoCreationOnSend(true); PolicyMap map = new PolicyMap(); PolicyEntry tempReplyQPolicy = new PolicyEntry(); tempReplyQPolicy.setOptimizedDispatch(true); tempReplyQPolicy.setGcInactiveDestinations(true); tempReplyQPolicy.setGcWithNetworkConsumers(true); tempReplyQPolicy.setInactiveTimeoutBeforeGC(1000); map.put(replyQWildcard, tempReplyQPolicy); broker.setDestinationPolicy(map); broker.addConnector("tcp://localhost:0"); brokers.add(broker); return broker; }
Example 4
Source File: DestinationGCTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); broker.setDestinations(new ActiveMQDestination[]{queue}); broker.setSchedulePeriodForDestinationPurge(1000); broker.setMaxPurgedDestinationsPerSweep(1); PolicyEntry entry = new PolicyEntry(); entry.setGcInactiveDestinations(true); entry.setInactiveTimeoutBeforeGC(3000); PolicyMap map = new PolicyMap(); map.setDefaultEntry(entry); broker.setDestinationPolicy(map); return broker; }