diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
index 60dd3eb747..33e7faad03 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
@@ -438,6 +438,8 @@ public final class ActiveMQDefaultConfiguration {
public static final int DEFAULT_DISK_SCAN = 5000;
+ public static final String DEFAULT_SYSTEM_PROPERTY_PREFIX = "brokerconfig.";
+
/**
* If true then the ActiveMQ Artemis Server will make use of any Protocol Managers that are in available on the classpath. If false then only the core protocol will be available, unless in Embedded mode where users can inject their own Protocol Managers.
*/
@@ -1175,4 +1177,8 @@ public final class ActiveMQDefaultConfiguration {
public static int getDefaultDiskScanPeriod() {
return DEFAULT_DISK_SCAN;
}
+
+ public static String getDefaultSystemPropertyPrefix() {
+ return DEFAULT_SYSTEM_PROPERTY_PREFIX;
+ }
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
index c1ed6ce4be..8f4b97d174 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
@@ -20,6 +20,7 @@ import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
@@ -49,6 +50,30 @@ public interface Configuration {
*/
Configuration setName(String name);
+
+ /**
+ * We use Bean-utils to pass in System.properties that start with {@link #setSystemPropertyPrefix(String)}.
+ * The default should be 'brokerconfig.' (Including the ".").
+ * For example if you want to set clustered through a system property you must do:
+ *
+ * -Dbrokerconfig.clustered=true
+ *
+ * The prefix is configured here.
+ * @param systemPropertyPrefix
+ * @return
+ */
+ Configuration setSystemPropertyPrefix(String systemPropertyPrefix);
+
+ /**
+ * See doc at {@link #setSystemPropertyPrefix(String)}.
+ * @return
+ */
+ String getSystemPropertyPrefix();
+
+ Configuration parseSystemProperties() throws Exception;
+
+ Configuration parseSystemProperties(Properties properties) throws Exception;
+
/**
* Returns whether this server is clustered.
* {@code true} if {@link #getClusterConfigurations()} is not empty.
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
index 53a5e089d6..dce0998434 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
@@ -36,6 +36,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
@@ -63,10 +64,14 @@ import org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings;
import org.apache.activemq.artemis.uri.AcceptorTransportConfigurationParser;
import org.apache.activemq.artemis.uri.ConnectorTransportConfigurationParser;
import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
+import org.apache.activemq.artemis.utils.uri.BeanSupport;
+import org.jboss.logging.Logger;
public class ConfigurationImpl implements Configuration, Serializable {
// Constants ------------------------------------------------------------------------------
+ private static final Logger logger = Logger.getLogger(ConfigurationImpl.class);
+
public static final JournalType DEFAULT_JOURNAL_TYPE = JournalType.ASYNCIO;
private static final long serialVersionUID = 4077088945050267843L;
@@ -254,6 +259,8 @@ public class ConfigurationImpl implements Configuration, Serializable {
private int diskScanPeriod = ActiveMQDefaultConfiguration.getDefaultDiskScanPeriod();
+ private String systemPropertyPrefix = ActiveMQDefaultConfiguration.getDefaultSystemPropertyPrefix();
+
/**
* Parent folder for all data folders.
*/
@@ -261,6 +268,46 @@ public class ConfigurationImpl implements Configuration, Serializable {
// Public -------------------------------------------------------------------------
+ @Override
+ public Configuration setSystemPropertyPrefix(String systemPropertyPrefix) {
+ this.systemPropertyPrefix = systemPropertyPrefix;
+ return this;
+ }
+
+ @Override
+ public String getSystemPropertyPrefix() {
+ return systemPropertyPrefix;
+ }
+
+
+ @Override
+ public Configuration parseSystemProperties() throws Exception {
+ parseSystemProperties(System.getProperties());
+ return this;
+ }
+
+ @Override
+ public Configuration parseSystemProperties(Properties properties) throws Exception {
+
+ Map beanProperties = new HashMap<>();
+
+
+ for (Map.Entry