Java Code Examples for org.apache.activemq.artemis.core.settings.impl.AddressSettings#merge()

The following examples show how to use org.apache.activemq.artemis.core.settings.impl.AddressSettings#merge() . 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: MultipliedDelayedMessageTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception
 */
protected void initServer() throws Exception {
   server = createServer(true, createDefaultInVMConfig());
   server.start();

   // Create settings to enable multiplied redelivery delay
   AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch("*");
   AddressSettings newAddressSettings = new AddressSettings().setRedeliveryDelay(DELAY).setRedeliveryMultiplier(MULTIPLIER).setMaxRedeliveryDelay(MAX_DELAY);
   newAddressSettings.merge(addressSettings);
   server.getAddressSettingsRepository().addMatch(queueName, newAddressSettings);
   locator = createInVMNonHALocator();
}
 
Example 2
Source File: DelayedMessageTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception
 */
protected void initServer() throws Exception {
   server = createServer(true, createDefaultInVMConfig());
   server.start();

   AddressSettings qs = server.getAddressSettingsRepository().getMatch("*");
   AddressSettings newSets = new AddressSettings().setRedeliveryDelay(DelayedMessageTest.DELAY);
   newSets.merge(qs);
   server.getAddressSettingsRepository().addMatch(qName, newSets);
   locator = createInVMNonHALocator();
}
 
Example 3
Source File: AddressSettingsTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingleMerge() {
   AddressSettings addressSettings = new AddressSettings();
   AddressSettings addressSettingsToMerge = new AddressSettings();
   SimpleString DLQ = new SimpleString("testDLQ");
   SimpleString exp = new SimpleString("testExpiryQueue");
   addressSettingsToMerge.setDeadLetterAddress(DLQ);
   addressSettingsToMerge.setExpiryAddress(exp);
   addressSettingsToMerge.setMaxDeliveryAttempts(1000);
   addressSettingsToMerge.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
   addressSettingsToMerge.setMaxSizeBytes(1001);
   addressSettingsToMerge.setMessageCounterHistoryDayLimit(1002);
   addressSettingsToMerge.setRedeliveryDelay(1003);
   addressSettingsToMerge.setPageSizeBytes(1004);
   addressSettingsToMerge.setMaxSizeBytesRejectThreshold(10 * 1024);

   addressSettings.merge(addressSettingsToMerge);
   Assert.assertEquals(addressSettings.getDeadLetterAddress(), DLQ);
   Assert.assertEquals(addressSettings.getExpiryAddress(), exp);
   Assert.assertEquals(addressSettings.getMaxDeliveryAttempts(), 1000);
   Assert.assertEquals(addressSettings.getMaxSizeBytes(), 1001);
   Assert.assertEquals(addressSettings.getMessageCounterHistoryDayLimit(), 1002);
   Assert.assertEquals(addressSettings.getRedeliveryDelay(), 1003);
   Assert.assertEquals(addressSettings.getPageSizeBytes(), 1004);
   Assert.assertEquals(AddressFullMessagePolicy.DROP, addressSettings.getAddressFullMessagePolicy());
   Assert.assertEquals(addressSettings.getMaxSizeBytesRejectThreshold(), 10 * 1024);
}
 
Example 4
Source File: AddressSettingsTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testMultipleMerge() {
   AddressSettings addressSettings = new AddressSettings();
   AddressSettings addressSettingsToMerge = new AddressSettings();
   SimpleString DLQ = new SimpleString("testDLQ");
   SimpleString exp = new SimpleString("testExpiryQueue");
   addressSettingsToMerge.setDeadLetterAddress(DLQ);
   addressSettingsToMerge.setExpiryAddress(exp);
   addressSettingsToMerge.setMaxDeliveryAttempts(1000);
   addressSettingsToMerge.setMaxSizeBytes(1001);
   addressSettingsToMerge.setMessageCounterHistoryDayLimit(1002);
   addressSettingsToMerge.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
   addressSettingsToMerge.setMaxSizeBytesRejectThreshold(10 * 1024);
   addressSettings.merge(addressSettingsToMerge);

   AddressSettings addressSettingsToMerge2 = new AddressSettings();
   SimpleString exp2 = new SimpleString("testExpiryQueue2");
   addressSettingsToMerge2.setExpiryAddress(exp2);
   addressSettingsToMerge2.setMaxSizeBytes(2001);
   addressSettingsToMerge2.setRedeliveryDelay(2003);
   addressSettingsToMerge2.setRedeliveryMultiplier(2.5);
   addressSettings.merge(addressSettingsToMerge2);

   Assert.assertEquals(addressSettings.getDeadLetterAddress(), DLQ);
   Assert.assertEquals(addressSettings.getExpiryAddress(), exp);
   Assert.assertEquals(addressSettings.getMaxDeliveryAttempts(), 1000);
   Assert.assertEquals(addressSettings.getMaxSizeBytes(), 1001);
   Assert.assertEquals(addressSettings.getMessageCounterHistoryDayLimit(), 1002);
   Assert.assertEquals(addressSettings.getRedeliveryDelay(), 2003);
   Assert.assertEquals(addressSettings.getRedeliveryMultiplier(), 2.5, 0.000001);
   Assert.assertEquals(AddressFullMessagePolicy.DROP, addressSettings.getAddressFullMessagePolicy());
   Assert.assertEquals(addressSettings.getMaxSizeBytesRejectThreshold(), 10 * 1024);
}
 
Example 5
Source File: AddressSettingsTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testMultipleMergeAll() {
   AddressSettings addressSettings = new AddressSettings();
   AddressSettings addressSettingsToMerge = new AddressSettings();
   SimpleString DLQ = new SimpleString("testDLQ");
   SimpleString exp = new SimpleString("testExpiryQueue");
   addressSettingsToMerge.setDeadLetterAddress(DLQ);
   addressSettingsToMerge.setExpiryAddress(exp);
   addressSettingsToMerge.setMaxSizeBytes(1001);
   addressSettingsToMerge.setRedeliveryDelay(1003);
   addressSettingsToMerge.setRedeliveryMultiplier(1.0);
   addressSettingsToMerge.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
   addressSettings.merge(addressSettingsToMerge);

   AddressSettings addressSettingsToMerge2 = new AddressSettings();
   SimpleString exp2 = new SimpleString("testExpiryQueue2");
   SimpleString DLQ2 = new SimpleString("testDlq2");
   addressSettingsToMerge2.setExpiryAddress(exp2);
   addressSettingsToMerge2.setDeadLetterAddress(DLQ2);
   addressSettingsToMerge2.setMaxDeliveryAttempts(2000);
   addressSettingsToMerge2.setMaxSizeBytes(2001);
   addressSettingsToMerge2.setMessageCounterHistoryDayLimit(2002);
   addressSettingsToMerge2.setRedeliveryDelay(2003);
   addressSettingsToMerge2.setRedeliveryMultiplier(2.0);
   addressSettingsToMerge2.setMaxRedeliveryDelay(5000);
   addressSettingsToMerge.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
   addressSettings.merge(addressSettingsToMerge2);

   Assert.assertEquals(addressSettings.getDeadLetterAddress(), DLQ);
   Assert.assertEquals(addressSettings.getExpiryAddress(), exp);
   Assert.assertEquals(addressSettings.getMaxDeliveryAttempts(), 2000);
   Assert.assertEquals(addressSettings.getMaxSizeBytes(), 1001);
   Assert.assertEquals(addressSettings.getMessageCounterHistoryDayLimit(), 2002);
   Assert.assertEquals(addressSettings.getRedeliveryDelay(), 1003);
   Assert.assertEquals(addressSettings.getRedeliveryMultiplier(), 1.0, 0.000001);
   Assert.assertEquals(addressSettings.getMaxRedeliveryDelay(), 5000);
   Assert.assertEquals(AddressFullMessagePolicy.DROP, addressSettings.getAddressFullMessagePolicy());
}