From b585adb203bfc654ff1d9bc0c9812c97ccf8958b Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 15 Dec 2015 12:31:21 +0000 Subject: [PATCH] ARTEMIS-311 - added broker name to jmx object name properties. Its now possible to also add the broker name to jmx tree avoiding clashes when multiple brokers are in a single vm. This is now the default but the old way can be used with some configuration https://issues.apache.org/jira/browse/ARTEMIS-311 --- .../activemq/artemis/cli/commands/Create.java | 11 ++++ .../artemis/cli/commands/etc/broker.xml | 2 + .../config/ActiveMQDefaultConfiguration.java | 7 +++ .../core/management/ObjectNameBuilder.java | 59 ++++++++++++++++--- .../artemis/core/config/Configuration.java | 11 ++++ .../core/config/impl/ConfigurationImpl.java | 15 ++++- .../impl/FileConfigurationParser.java | 2 + .../impl/ManagementServiceImpl.java | 2 +- .../schema/artemis-configuration.xsd | 8 +++ docs/user-manual/en/management.md | 46 +++++++++------ .../integration/management/JMXDomainTest.java | 2 +- 11 files changed, 136 insertions(+), 29 deletions(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index cb1ae12d4f9..324776edd4a 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -91,6 +91,9 @@ public class Create extends InputAbstract { @Option(name = "--host", description = "The host name of the broker (Default: 0.0.0.0 or input if clustered)") String host; + @Option(name = "--name", description = "The name of the broker (Default: same as host)") + String name; + @Option(name = "--port-offset", description = "Off sets the default ports") int portOffset; @@ -512,9 +515,13 @@ public Object run(ActionContext context) throws Exception { if (clustered) { filters.put("${host}", getHostForClustered()); + if (name == null) { + name = getHostForClustered(); + } String connectorSettings = readTextFile(ETC_CONNECTOR_SETTINGS_TXT); connectorSettings = applyFilters(connectorSettings, filters); + filters.put("${name}", name); filters.put("${connector-config.settings}", connectorSettings); filters.put("${cluster-security.settings}", readTextFile(ETC_CLUSTER_SECURITY_SETTINGS_TXT)); filters.put("${cluster.settings}", applyFilters(readTextFile(ETC_CLUSTER_SETTINGS_TXT), filters)); @@ -522,6 +529,10 @@ public Object run(ActionContext context) throws Exception { filters.put("${cluster-password}", getClusterPassword()); } else { + if (name == null) { + name = getHost(); + } + filters.put("${name}", name); filters.put("${host}", getHost()); filters.put("${connector-config.settings}", ""); filters.put("${cluster-security.settings}", ""); diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml index 49845f7d9e3..21362c224a0 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml @@ -29,6 +29,8 @@ under the License. + ${name} + ${persistence-enabled}