Java Code Examples for org.apache.activemq.artemis.core.settings.impl.AddressSettings#setDeadLetterAddress()
The following examples show how to use
org.apache.activemq.artemis.core.settings.impl.AddressSettings#setDeadLetterAddress() .
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: JMSMessageGroupsTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected void configureAddressPolicy(ActiveMQServer server) { super.configureAddressPolicy(server); AddressSettings addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); addressSettings.setDefaultGroupFirstKey(SimpleString.toSimpleString("JMSXFirstInGroupID")); server.getConfiguration().getAddressesSettings().put("GroupFirst.#", addressSettings); }
Example 2
Source File: AmqpClientTestSupport.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected void configureAddressPolicy(ActiveMQServer server) { // Address configuration AddressSettings addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); server.getConfiguration().getAddressesSettings().put("#", addressSettings); Set<TransportConfiguration> acceptors = server.getConfiguration().getAcceptorConfigurations(); for (TransportConfiguration tc : acceptors) { if (tc.getName().equals("netty-acceptor")) { tc.getExtraParams().put("anycastPrefix", "anycast://"); tc.getExtraParams().put("multicastPrefix", "multicast://"); } } }
Example 3
Source File: DLQAfterExpiredMessageTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void configureAddressPolicy(ActiveMQServer server) { // Address configuration AddressSettings addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); addressSettings.setExpiryAddress(SimpleString.toSimpleString(getExpiryQueue())); addressSettings.setMaxDeliveryAttempts(1); server.getConfiguration().getAddressesSettings().put("#", addressSettings); server.getConfiguration().getAddressesSettings().put(getExpiryQueue(), addressSettings); }
Example 4
Source File: MQTTTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
private ActiveMQServer createServerForMQTT() throws Exception { Configuration defaultConfig = createDefaultConfig(true).setIncomingInterceptorClassNames(singletonList(MQTTIncomingInterceptor.class.getName())).setOutgoingInterceptorClassNames(singletonList(MQTTOutoingInterceptor.class.getName())); AddressSettings addressSettings = new AddressSettings(); addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLA")); addressSettings.setExpiryAddress(SimpleString.toSimpleString("EXPIRY")); defaultConfig.getAddressesSettings().put("#", addressSettings); return createServer(true, defaultConfig); }
Example 5
Source File: AddressSettingsTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@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 6
Source File: AddressSettingsTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@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 7
Source File: AddressSettingsTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@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()); }
Example 8
Source File: SendDLQNoRouteTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test(timeout = 20_000) public void testDLQNoRoute() throws Exception { AddressSettings addressSettings = new AddressSettings().setSendToDLAOnNoRoute(true); addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLA")); server.getAddressSettingsRepository().addMatch("#", addressSettings); AddressInfo info = new AddressInfo(SimpleString.toSimpleString("info")).addRoutingType(RoutingType.MULTICAST); server.addAddressInfo(info); AddressInfo dla = new AddressInfo(SimpleString.toSimpleString("DLA")).addRoutingType(RoutingType.MULTICAST); server.addAddressInfo(dla); ServerLocator locator = createNonHALocator(false); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(true, true); ClientProducer producer = session.createProducer("info"); producer.send(session.createMessage(true)); session.commit(); }