Java Code Examples for org.apache.activemq.broker.region.policy.PolicyMap#setDefaultEntry()
The following examples show how to use
org.apache.activemq.broker.region.policy.PolicyMap#setDefaultEntry() .
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: DurableSubscriptionSelectorTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
private void startBroker(boolean deleteMessages) throws Exception { broker = new BrokerService(); broker.setBrokerName("test-broker"); if (deleteMessages) { broker.setDeleteAllMessagesOnStartup(true); } setDefaultPersistenceAdapter(broker); /* use maxPageSize policy in place of always pulling from the broker in maxRows chunks if (broker.getPersistenceAdapter() instanceof JDBCPersistenceAdapter) { ((JDBCPersistenceAdapter)broker.getPersistenceAdapter()).setMaxRows(5000); }*/ PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setMaxPageSize(5000); policyMap.setDefaultEntry(defaultEntry); broker.setDestinationPolicy(policyMap); broker.start(); }
Example 2
Source File: DiscriminatingConsumerLoadTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { broker = new BrokerService(); broker.setPersistent(false); // workaround is to ensure sufficient dispatch buffer for the destination PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultPolicy = new PolicyEntry(); defaultPolicy.setMaxPageSize(testSize); policyMap.setDefaultEntry(defaultPolicy); broker.setDestinationPolicy(policyMap); broker.start(); super.setUp(); this.producerConnection = this.createConnection(); this.consumerConnection = this.createConnection(); }
Example 3
Source File: MessageGroupReconnectDistributionTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected BrokerService createBroker() throws Exception { BrokerService service = new BrokerService(); service.setAdvisorySupport(false); service.setPersistent(false); service.setUseJmx(true); PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setUseConsumerPriority(consumerPriority); policy.setMessageGroupMapFactoryType("cached?cacheSize=" + (numConsumers - 1)); policyMap.setDefaultEntry(policy); service.setDestinationPolicy(policyMap); connector = service.addConnector("tcp://localhost:0"); return service; }
Example 4
Source File: MessageGroupConfigTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public MessageGroupMap doTestGroupConfiguration(String type, Class classType) throws Exception { broker = new BrokerService(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setMessageGroupMapFactoryType(type); PolicyMap policyMap = new PolicyMap(); policyMap.setDefaultEntry(defaultEntry); broker.setDestinationPolicy(policyMap); broker.start(); super.topic = false; ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo"); Queue brokerDestination = (Queue) broker.getDestination(destination); assertNotNull(brokerDestination); MessageGroupMap messageGroupMap = brokerDestination.getMessageGroupOwners(); assertNotNull(messageGroupMap); assertTrue(messageGroupMap.getClass().isAssignableFrom(classType)); return messageGroupMap; }
Example 5
Source File: DiscardingDeadLetterPolicyTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); DeadLetterStrategy strategy = new DiscardingDeadLetterStrategy(); strategy.setProcessNonPersistent(true); policy.setDeadLetterStrategy(strategy); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 6
Source File: AbortSlowAckConsumer1Test.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy(); strategy.setAbortConnection(abortConnection); strategy.setCheckPeriod(checkPeriod); strategy.setMaxSlowDuration(maxSlowDuration); strategy.setMaxTimeSinceLastAck(maxTimeSinceLastAck); policy.setSlowConsumerStrategy(strategy); policy.setQueuePrefetch(10); policy.setTopicPrefetch(10); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 7
Source File: SimpleDispatchPolicyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@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; }
Example 8
Source File: JmsQueueBrowserTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService brokerService = super.createBroker(); PolicyMap policyMap = new PolicyMap(); PolicyEntry policyEntry = new PolicyEntry(); policyEntry.setUseCache(isUseCache); policyEntry.setMaxBrowsePageSize(4096); policyMap.setDefaultEntry(policyEntry); brokerService.setDestinationPolicy(policyMap); return brokerService; }
Example 9
Source File: JmsProducerFlowControlFailIfNoSpaceTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override protected void configureBrokerPolicies(BrokerService brokerService) { PolicyEntry policy = new PolicyEntry(); policy.setMemoryLimit(1); policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy()); policy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy()); policy.setProducerFlowControl(true); PolicyMap policyMap = new PolicyMap(); policyMap.setDefaultEntry(policy); brokerService.setDestinationPolicy(policyMap); brokerService.getSystemUsage().setSendFailIfNoSpace(true); }
Example 10
Source File: ExpiredMessagesWithNoConsumerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
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(); }
Example 11
Source File: ProduceToAMQPTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override protected void configureBrokerPolicies(BrokerService broker) { PolicyEntry policyEntry = new PolicyEntry(); policyEntry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy()); policyEntry.setPrioritizedMessages(false); policyEntry.setExpireMessagesPeriod(0); policyEntry.setEnableAudit(false); policyEntry.setOptimizedDispatch(true); policyEntry.setQueuePrefetch(100); PolicyMap policyMap = new PolicyMap(); policyMap.setDefaultEntry(policyEntry); broker.setDestinationPolicy(policyMap); }
Example 12
Source File: DurableSubscriptionHangTestCase.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Before public void startBroker() throws Exception { brokerService = new BrokerService(); brokerService.setDeleteAllMessagesOnStartup(true); brokerService.setBrokerName(brokerName); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setExpireMessagesPeriod(5000); policyMap.setDefaultEntry(defaultEntry); brokerService.setDestinationPolicy(policyMap); brokerService.start(); }
Example 13
Source File: DurableSubscriptionOfflineTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void createBroker(boolean deleteAllMessages) throws Exception { String currentTestName = getName(true); broker = BrokerFactory.createBroker("broker:(vm://" + currentTestName + ")"); broker.setBrokerName(currentTestName); broker.setDeleteAllMessagesOnStartup(deleteAllMessages); broker.getManagementContext().setCreateConnector(false); broker.setAdvisorySupport(false); broker.setKeepDurableSubsActive(keepDurableSubsActive); broker.addConnector("tcp://0.0.0.0:0"); if (usePrioritySupport) { PolicyEntry policy = new PolicyEntry(); policy.setPrioritizedMessages(true); PolicyMap policyMap = new PolicyMap(); policyMap.setDefaultEntry(policy); broker.setDestinationPolicy(policyMap); } setDefaultPersistenceAdapter(broker); if (broker.getPersistenceAdapter() instanceof JDBCPersistenceAdapter) { // ensure it kicks in during tests ((JDBCPersistenceAdapter) broker.getPersistenceAdapter()).setCleanupPeriod(2 * 1000); } else if (broker.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) { // have lots of journal files ((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).setJournalMaxFileLength(journalMaxFileLength); } broker.start(); broker.waitUntilStarted(); }
Example 14
Source File: AbstractElasticSearchActiveMQTest.java From camunda-bpm-elasticsearch with Apache License 2.0 | 5 votes |
protected BrokerService createBroker() { BrokerService brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setUseJmx(false); PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setConsumersBeforeDispatchStarts(2); policy.setTimeBeforeDispatchStarts(1000); policyMap.setDefaultEntry(policy); brokerService.setDestinationPolicy(policyMap); return brokerService; }
Example 15
Source File: OnePrefetchAsyncConsumerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override 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; }
Example 16
Source File: TwoBrokerQueueClientsReconnectTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void configureBroker(BrokerService broker) { PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setEnableAudit(false); policyMap.setDefaultEntry(defaultEntry); broker.setDestinationPolicy(policyMap); }
Example 17
Source File: DeadLetterTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected BrokerService createBroker() throws Exception { BrokerService broker = new BrokerService(); broker.setPersistent(false); PolicyEntry policy = new PolicyEntry(); DeadLetterStrategy defaultDeadLetterStrategy = policy.getDeadLetterStrategy(); if (defaultDeadLetterStrategy != null) { defaultDeadLetterStrategy.setProcessNonPersistent(true); } PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 18
Source File: RedeliveryRestartWithExceptionTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void configureBroker(BrokerService broker, boolean throwExceptionOnUpdate) throws Exception { PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setPersistJMSRedelivered(true); policyMap.setDefaultEntry(policy); broker.setDestinationPolicy(policyMap); broker.setPersistenceAdapter(new KahaDBWithUpdateExceptionPersistenceAdapter(throwExceptionOnUpdate)); broker.addConnector("tcp://0.0.0.0:0"); }
Example 19
Source File: ExpiryHogTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService bs = new BrokerService(); bs.setDeleteAllMessagesOnStartup(true); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setExpireMessagesPeriod(5000); defaultEntry.setUseCache(false); policyMap.setDefaultEntry(defaultEntry); bs.setDestinationPolicy(policyMap); return bs; }
Example 20
Source File: DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
private void startBroker(boolean deleteAllMessages) throws Exception { if (broker != null) return; broker = BrokerFactory.createBroker("broker:(vm://" + getName() + ")"); broker.setBrokerName(getName()); broker.setAdvisorySupport(false); broker.setDeleteAllMessagesOnStartup(deleteAllMessages); switch (PERSISTENT_ADAPTER) { case MEMORY: broker.setPersistent(false); break; case LEVELDB: File amqData = new File("activemq-data/" + getName() + "-leveldb"); if (deleteAllMessages) delete(amqData); broker.setPersistent(true); LevelDBStore amq = new LevelDBStore(); amq.setDirectory(amqData); broker.setPersistenceAdapter(amq); break; case KAHADB: File kahadbData = new File("activemq-data/" + getName() + "-kahadb"); if (deleteAllMessages) delete(kahadbData); broker.setPersistent(true); KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter(); kahadb.setDirectory(kahadbData); kahadb.setJournalMaxFileLength(5 * 1024 * 1024); broker.setPersistenceAdapter(kahadb); break; } broker.addConnector("tcp://localhost:61656"); broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024); broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024); broker.getSystemUsage().getStoreUsage().setLimit(1024 * 1024 * 1024); PolicyMap policyMap = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setMaxAuditDepth(20000); policyMap.setDefaultEntry(defaultEntry); broker.setDestinationPolicy(policyMap); broker.start(); }