This closes #3620
This commit is contained in:
commit
3e5795e965
|
@ -997,8 +997,13 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
|||
Element node = (Element) elements.item(0);
|
||||
NodeList list = node.getElementsByTagName("address-setting");
|
||||
for (int i = 0; i < list.getLength(); i++) {
|
||||
Pair<String, AddressSettings> addressSettings = parseAddressSettings(list.item(i));
|
||||
config.getAddressesSettings().put(addressSettings.getA(), addressSettings.getB());
|
||||
Pair<String, AddressSettings> newAddressSettings = parseAddressSettings(list.item(i));
|
||||
Map<String, AddressSettings> addressSettings = config.getAddressesSettings();
|
||||
if (addressSettings.containsKey(newAddressSettings.getA())) {
|
||||
ActiveMQServerLogger.LOGGER.duplicateAddressSettingMatch(newAddressSettings.getA());
|
||||
} else {
|
||||
config.getAddressesSettings().put(newAddressSettings.getA(), newAddressSettings.getB());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1730,6 +1730,11 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
|||
format = Message.Format.MESSAGE_FORMAT)
|
||||
void gettingSslHandlerFailed(String clientAddress, String cause);
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 222301, value = "Duplicate address-setting match found: {0}. These settings will be ignored! Please review your broker.xml and consolidate any duplicate address-setting elements.",
|
||||
format = Message.Format.MESSAGE_FORMAT)
|
||||
void duplicateAddressSettingMatch(String match);
|
||||
|
||||
@LogMessage(level = Logger.Level.ERROR)
|
||||
@Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT)
|
||||
void initializationError(@Cause Throwable e);
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
|
|||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.apache.activemq.artemis.utils.ClassloadingUtil;
|
||||
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
|
||||
import org.apache.activemq.artemis.utils.PasswordMaskingUtil;
|
||||
import org.apache.activemq.artemis.utils.StringPrintStream;
|
||||
|
@ -95,6 +96,14 @@ public class FileConfigurationParserTest extends ActiveMQTestBase {
|
|||
assertEquals(0, server.locateQueue(SimpleString.toSimpleString("q")).getMaxConsumers());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateAddressSettings() throws Exception {
|
||||
FileConfigurationParser parser = new FileConfigurationParser();
|
||||
Configuration config = parser.parseMainConfig(ClassloadingUtil.findResource("FileConfigurationParser-duplicateAddressSettings.xml").openStream());
|
||||
|
||||
Assert.assertEquals(123, config.getAddressesSettings().get("foo").getRedistributionDelay());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParsingClusterConnectionURIs() throws Exception {
|
||||
FileConfigurationParser parser = new FileConfigurationParser();
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration xmlns="urn:activemq"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
||||
<core xmlns="urn:activemq:core">
|
||||
<persistence-enabled>false</persistence-enabled>
|
||||
<address-settings>
|
||||
<address-setting match="foo">
|
||||
<redistribution-delay>123</redistribution-delay>
|
||||
</address-setting>
|
||||
<address-setting match="foo">
|
||||
<redistribution-delay>456</redistribution-delay>
|
||||
</address-setting>
|
||||
</address-settings>
|
||||
</core>
|
||||
</configuration>
|
Loading…
Reference in New Issue