public RoutingType getDefaultRoutingType(SimpleString address) { return manager.getServer().getAddressSettingsRepository().getMatch(address.toString()).getDefaultAddressRoutingType(); }
public RoutingType getDefaultRoutingType(SimpleString address) { return manager.getServer().getAddressSettingsRepository().getMatch(address.toString()).getDefaultAddressRoutingType(); }
AddressInfo addressInfo = manager.getServer().getAddressInfo(simpleQueue); AddressSettings addressSettings = manager.getServer().getAddressSettingsRepository().getMatch(queue); RoutingType effectiveAddressRoutingType = routingType == null ? addressSettings.getDefaultAddressRoutingType() : routingType;
AddressInfo addressInfo = manager.getServer().getAddressInfo(simpleQueue); AddressSettings addressSettings = manager.getServer().getAddressSettingsRepository().getMatch(queue); RoutingType effectiveAddressRoutingType = routingType == null ? addressSettings.getDefaultAddressRoutingType() : routingType;
} else { AddressSettings as = server.getAddressSettingsRepository().getMatch(addressToUse.toString()); routingTypeToUse = as.getDefaultAddressRoutingType();
@Test public void testAMQPSenderHonourRoutingTypeOfExistingAddress() throws Exception { RoutingType routingType = server.getConfiguration().getAddressesSettings().get("#").getDefaultAddressRoutingType(); Assert.assertEquals(RoutingType.ANYCAST, routingType); try (ActiveMQConnection coreConnection = (ActiveMQConnection) createCoreConnection(); ClientSession clientSession = coreConnection.getSessionFactory().createSession()) { RoutingType addressRoutingType = RoutingType.MULTICAST; SimpleString address = SimpleString.toSimpleString("myTopic_" + UUID.randomUUID().toString()); clientSession.createAddress(address, addressRoutingType, false); ClientSession.AddressQuery addressQuery = clientSession.addressQuery(address); Assert.assertTrue(addressQuery.isExists()); Assert.assertTrue(addressQuery.getQueueNames().isEmpty()); AmqpClient client = createAmqpClient(guestUser, guestPass); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(address.toString()); try { ClientSession.QueueQuery queueQuery = clientSession.queueQuery(address); Assert.assertFalse(queueQuery.isExists()); Assert.assertEquals(addressRoutingType, queueQuery.getRoutingType()); } finally { sender.close(); session.close(); connection.close(); } } }
@Test public void testAMQPSenderCreateQueueWithDefaultRoutingTypeIfAddressDoNotExist() throws Exception { RoutingType defaultRoutingType = server.getConfiguration().getAddressesSettings().get("#").getDefaultAddressRoutingType(); Assert.assertEquals(RoutingType.ANYCAST, defaultRoutingType); try (ActiveMQConnection coreConnection = (ActiveMQConnection) createCoreConnection(); ClientSession clientSession = coreConnection.getSessionFactory().createSession()) { SimpleString address = SimpleString.toSimpleString("myTopic_" + UUID.randomUUID().toString()); ClientSession.AddressQuery addressQuery = clientSession.addressQuery(address); Assert.assertFalse(addressQuery.isExists()); Assert.assertTrue(addressQuery.getQueueNames().isEmpty()); AmqpClient client = createAmqpClient(guestUser, guestPass); AmqpConnection connection = addConnection(client.connect()); AmqpSession session = connection.createSession(); AmqpSender sender = session.createSender(address.toString()); try { addressQuery = clientSession.addressQuery(address); Assert.assertTrue(addressQuery.isExists()); Assert.assertThat(addressQuery.getQueueNames(), CoreMatchers.hasItem(address)); ClientSession.QueueQuery queueQuery = clientSession.queueQuery(address); Assert.assertTrue(queueQuery.isExists()); Assert.assertEquals(defaultRoutingType, queueQuery.getRoutingType()); } finally { sender.close(); session.close(); connection.close(); } } } }
assertEquals(5, conf.getAddressesSettings().get("a1").getDefaultMaxConsumers()); assertEquals(RoutingType.ANYCAST, conf.getAddressesSettings().get("a1").getDefaultQueueRoutingType()); assertEquals(RoutingType.MULTICAST, conf.getAddressesSettings().get("a1").getDefaultAddressRoutingType()); assertEquals(15, conf.getAddressesSettings().get("a2").getDefaultMaxConsumers()); assertEquals(RoutingType.MULTICAST, conf.getAddressesSettings().get("a2").getDefaultQueueRoutingType()); assertEquals(RoutingType.ANYCAST, conf.getAddressesSettings().get("a2").getDefaultAddressRoutingType()); assertEquals(10000, conf.getAddressesSettings().get("a2").getDefaultConsumerWindowSize());