You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/11/07 16:36:49 UTC

[29/50] [abbrv] activemq-artemis git commit: ARTEMIS-782 Added configuration elements for new address model

ARTEMIS-782 Added configuration elements for new address model


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/6e01d686
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/6e01d686
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/6e01d686

Branch: refs/heads/ARTEMIS-780
Commit: 6e01d6861846af09115d13c29e4d28fdb70643ee
Parents: 6c664c1
Author: Martyn Taylor <mt...@redhat.com>
Authored: Tue Oct 18 19:45:02 2016 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Nov 7 11:28:07 2016 -0500

----------------------------------------------------------------------
 .../config/ActiveMQDefaultConfiguration.java    |  12 ++
 .../artemis/core/config/Configuration.java      |  15 ++
 .../core/config/CoreAddressConfiguration.java   | 145 +++++++++++++++++++
 .../core/config/CoreQueueConfiguration.java     |  43 ++++++
 .../core/config/impl/ConfigurationImpl.java     |  20 +++
 .../deployers/impl/FileConfigurationParser.java |  80 +++++++++-
 .../resources/schema/artemis-configuration.xsd  |  78 +++++++++-
 .../impl/DefaultsFileConfigurationTest.java     |   2 +
 .../core/config/impl/FileConfigurationTest.java |  63 ++++++++
 .../resources/ConfigurationTest-full-config.xml |  26 ++++
 10 files changed, 478 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
----------------------------------------------------------------------
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 60dd3eb..b952430 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,10 @@ public final class ActiveMQDefaultConfiguration {
 
    public static final int DEFAULT_DISK_SCAN = 5000;
 
+   public static final int DEFAULT_MAX_QUEUE_CONSUMERS = -1;
+
+   public static final boolean DEFAULT_DELETE_QUEUE_ON_NO_CONSUMERS = false;
+
    /**
     * 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 +1179,12 @@ public final class ActiveMQDefaultConfiguration {
    public static int getDefaultDiskScanPeriod() {
       return DEFAULT_DISK_SCAN;
    }
+
+   public static int getDefaultMaxQueueConsumers() {
+      return DEFAULT_MAX_QUEUE_CONSUMERS;
+   }
+
+   public static boolean getDefaultDeleteQueueOnNoConsumers() {
+      return DEFAULT_DELETE_QUEUE_ON_NO_CONSUMERS;
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
----------------------------------------------------------------------
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 c1ed6ce..8d47f97 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
@@ -404,6 +404,21 @@ public interface Configuration {
    Configuration addQueueConfiguration(final CoreQueueConfiguration config);
 
    /**
+    * Returns the addresses configured for this server.
+    */
+   List<CoreAddressConfiguration> getAddressConfigurations();
+
+   /**
+    * Sets the addresses configured for this server.
+    */
+   Configuration setAddressConfigurations(final List<CoreAddressConfiguration> configs);
+
+   /**
+    * Adds an addresses configuration
+    */
+   Configuration addAddressConfiguration(final CoreAddressConfiguration config);
+
+   /**
     * Returns the management address of this server. <br>
     * Clients can send management messages to this address to manage this server. <br>
     * Default value is {@link org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration#DEFAULT_MANAGEMENT_ADDRESS}.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
new file mode 100644
index 0000000..cb6d43f
--- /dev/null
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+package org.apache.activemq.artemis.core.config;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
+
+public class CoreAddressConfiguration implements Serializable {
+
+   public enum RoutingType {
+      MULTICAST,
+      ANYCAST
+   }
+
+   private String name = null;
+
+   private RoutingType routingType = null;
+
+   private Integer defaultMaxConsumers = ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers();
+
+   private Boolean defaultDeleteOnNoConsumers = ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers();
+
+   private List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
+
+   public CoreAddressConfiguration() {
+   }
+
+   public String getName() {
+      return name;
+   }
+
+   public CoreAddressConfiguration setName(String name) {
+      this.name = name;
+      return this;
+   }
+
+   public RoutingType getRoutingType() {
+      return routingType;
+   }
+
+   public CoreAddressConfiguration setRoutingType(RoutingType routingType) {
+      this.routingType = routingType;
+      return this;
+   }
+
+   public CoreAddressConfiguration setQueueConfigurations(List<CoreQueueConfiguration> queueConfigurations) {
+      this.queueConfigurations = queueConfigurations;
+      return this;
+   }
+
+   public CoreAddressConfiguration addQueueConfiguration(CoreQueueConfiguration queueConfiguration) {
+      this.queueConfigurations.add(queueConfiguration);
+      return this;
+   }
+
+   public List<CoreQueueConfiguration> getQueueConfigurations() {
+      return queueConfigurations;
+   }
+
+   public Boolean getDefaultDeleteOnNoConsumers() {
+      return defaultDeleteOnNoConsumers;
+   }
+
+   public CoreAddressConfiguration setDefaultDeleteOnNoConsumers(Boolean defaultDeleteOnNoConsumers) {
+      this.defaultDeleteOnNoConsumers = defaultDeleteOnNoConsumers;
+      return this;
+   }
+
+   public Integer getDefaultMaxConsumers() {
+      return defaultMaxConsumers;
+   }
+
+   public CoreAddressConfiguration setDefaultMaxConsumers(Integer defaultMaxConsumers) {
+      this.defaultMaxConsumers = defaultMaxConsumers;
+      return this;
+   }
+
+   @Override
+   public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((name == null) ? 0 : name.hashCode());
+      result = prime * result + ((routingType == null) ? 0 : routingType.hashCode());
+      result = prime * result + ((queueConfigurations == null) ? 0 : queueConfigurations.hashCode());
+      result = prime * result + ((defaultMaxConsumers == null) ? 0 : defaultMaxConsumers.hashCode());
+      result = prime * result + ((defaultDeleteOnNoConsumers == null) ? 0 : defaultDeleteOnNoConsumers.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj)
+         return true;
+      if (obj == null)
+         return false;
+      if (getClass() != obj.getClass())
+         return false;
+      CoreAddressConfiguration other = (CoreAddressConfiguration) obj;
+      if (name == null) {
+         if (other.name != null)
+            return false;
+      } else if (!name.equals(other.name))
+         return false;
+      if (routingType == null) {
+         if (other.routingType != null)
+            return false;
+      } else if (!routingType.equals(other.routingType))
+         return false;
+      if (queueConfigurations == null) {
+         if (other.queueConfigurations != null)
+            return false;
+      } else if (!queueConfigurations.equals(other.queueConfigurations))
+         return false;
+      if (defaultMaxConsumers == null) {
+         if (other.defaultMaxConsumers != null)
+            return false;
+      } else if (!defaultMaxConsumers.equals(other.defaultMaxConsumers))
+         return false;
+      if (defaultDeleteOnNoConsumers == null) {
+         if (other.defaultDeleteOnNoConsumers != null)
+            return false;
+      } else if (!defaultDeleteOnNoConsumers.equals(other.defaultDeleteOnNoConsumers)) {
+         return false;
+      }
+
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
index 2e7b9ca..79b2fd2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
@@ -30,6 +30,10 @@ public class CoreQueueConfiguration implements Serializable {
 
    private boolean durable = true;
 
+   private Integer maxConsumers = null;
+
+   private Boolean deleteOnNoConsumers = null;
+
    public CoreQueueConfiguration() {
    }
 
@@ -49,6 +53,8 @@ public class CoreQueueConfiguration implements Serializable {
       return durable;
    }
 
+
+
    /**
     * @param address the address to set
     */
@@ -81,6 +87,30 @@ public class CoreQueueConfiguration implements Serializable {
       return this;
    }
 
+   /**
+    * @param maxConsumers for this queue, default is -1 (unlimited)
+    */
+   public CoreQueueConfiguration setMaxConsumers(Integer maxConsumers) {
+      this.maxConsumers = maxConsumers;
+      return this;
+   }
+
+   /**
+    * @param deleteOnNoConsumers delete this queue when consumer count reaches 0, default is false
+    */
+   public CoreQueueConfiguration setDeleteOnNoConsumers(Boolean deleteOnNoConsumers) {
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+      return this;
+   }
+
+   public Boolean getDeleteOnNoConsumers() {
+      return deleteOnNoConsumers;
+   }
+
+   public Integer getMaxConsumers() {
+      return maxConsumers;
+   }
+
    @Override
    public int hashCode() {
       final int prime = 31;
@@ -89,6 +119,8 @@ public class CoreQueueConfiguration implements Serializable {
       result = prime * result + (durable ? 1231 : 1237);
       result = prime * result + ((filterString == null) ? 0 : filterString.hashCode());
       result = prime * result + ((name == null) ? 0 : name.hashCode());
+      result = prime * result + ((maxConsumers == null) ? 0 : maxConsumers.hashCode());
+      result = prime * result + ((deleteOnNoConsumers == null) ? 0 : deleteOnNoConsumers.hashCode());
       return result;
    }
 
@@ -118,6 +150,17 @@ public class CoreQueueConfiguration implements Serializable {
             return false;
       } else if (!name.equals(other.name))
          return false;
+      if (maxConsumers == null) {
+         if (other.maxConsumers != null)
+            return false;
+      } else if (!maxConsumers.equals(other.maxConsumers))
+         return false;
+      if (deleteOnNoConsumers == null) {
+         if (other.deleteOnNoConsumers != null)
+            return false;
+      } else if (!deleteOnNoConsumers.equals(other.deleteOnNoConsumers)) {
+         return false;
+      }
       return true;
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
----------------------------------------------------------------------
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 53a5e08..be0dd6a 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
@@ -47,6 +47,7 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration;
 import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration;
+import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
 import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.config.DivertConfiguration;
 import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
@@ -129,6 +130,8 @@ public class ConfigurationImpl implements Configuration, Serializable {
 
    private List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
 
+   private List<CoreAddressConfiguration> addressConfigurations = new ArrayList<>();
+
    protected transient List<BroadcastGroupConfiguration> broadcastGroupConfigurations = new ArrayList<>();
 
    protected transient Map<String, DiscoveryGroupConfiguration> discoveryGroupConfigurations = new LinkedHashMap<>();
@@ -595,6 +598,23 @@ public class ConfigurationImpl implements Configuration, Serializable {
    }
 
    @Override
+   public List<CoreAddressConfiguration> getAddressConfigurations() {
+      return addressConfigurations;
+   }
+
+   @Override
+   public Configuration setAddressConfigurations(List<CoreAddressConfiguration> configs) {
+      this.addressConfigurations = configs;
+      return this;
+   }
+
+   @Override
+   public Configuration addAddressConfiguration(CoreAddressConfiguration config) {
+      this.addressConfigurations.add(config);
+      return this;
+   }
+
+   @Override
    public Map<String, DiscoveryGroupConfiguration> getDiscoveryGroupConfigurations() {
       return discoveryGroupConfigurations;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
index 02a9e94..9cce5d3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
@@ -43,6 +43,7 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration;
 import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration;
+import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
 import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.config.DivertConfiguration;
 import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
@@ -544,6 +545,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
 
       parseQueues(e, config);
 
+      parseAddresses(e, config);
+
       parseSecurity(e, config);
 
       NodeList connectorServiceConfigs = e.getElementsByTagName("connector-service");
@@ -587,13 +590,35 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
     */
    private void parseQueues(final Element e, final Configuration config) {
       NodeList elements = e.getElementsByTagName("queues");
+      if (elements.getLength() != 0) {
+         Element node = (Element) elements.item(0);
+         config.setQueueConfigurations(parseQueueConfigurations(node));
+      }
+   }
+
+   private List<CoreQueueConfiguration> parseQueueConfigurations(final Element node) {
+      List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
+      NodeList list = node.getElementsByTagName("queue");
+      for (int i = 0; i < list.getLength(); i++) {
+         CoreQueueConfiguration queueConfig = parseQueueConfiguration(list.item(i));
+         queueConfigurations.add(queueConfig);
+      }
+      return queueConfigurations;
+   }
+
+   /**
+    * @param e
+    * @param config
+    */
+   private void parseAddresses(final Element e, final Configuration config) {
+      NodeList elements = e.getElementsByTagName("addresses");
 
       if (elements.getLength() != 0) {
          Element node = (Element) elements.item(0);
-         NodeList list = node.getElementsByTagName("queue");
+         NodeList list = node.getElementsByTagName("address");
          for (int i = 0; i < list.getLength(); i++) {
-            CoreQueueConfiguration queueConfig = parseQueueConfiguration(list.item(i));
-            config.getQueueConfigurations().add(queueConfig);
+            CoreAddressConfiguration addrConfig = parseAddressConfiguration(list.item(i));
+            config.getAddressConfigurations().add(addrConfig);
          }
       }
    }
@@ -831,9 +856,20 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
       String address = null;
       String filterString = null;
       boolean durable = true;
+      Integer maxConsumers = null;
+      Boolean deleteOnNoConsumers = null;
+
+      NamedNodeMap attributes = node.getAttributes();
+      for (int i = 0; i < attributes.getLength(); i++) {
+         Node item = attributes.item(i);
+         if (item.getNodeName().equals("max-consumers")) {
+            maxConsumers = Integer.parseInt(item.getNodeValue());
+         } else if (item.getNodeName().equals("delete-on-no-consumers")) {
+            deleteOnNoConsumers = Boolean.parseBoolean(item.getNodeValue());
+         }
+      }
 
       NodeList children = node.getChildNodes();
-
       for (int j = 0; j < children.getLength(); j++) {
          Node child = children.item(j);
 
@@ -846,7 +882,41 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
          }
       }
 
-      return new CoreQueueConfiguration().setAddress(address).setName(name).setFilterString(filterString).setDurable(durable);
+      return new CoreQueueConfiguration()
+         .setAddress(address)
+         .setName(name)
+         .setFilterString(filterString)
+         .setDurable(durable)
+         .setMaxConsumers(maxConsumers)
+         .setDeleteOnNoConsumers(deleteOnNoConsumers);
+   }
+
+   protected CoreAddressConfiguration parseAddressConfiguration(final Node node) {
+      String name = getAttributeValue(node, "name");
+      String routingType = getAttributeValue(node, "type");
+
+      CoreAddressConfiguration addressConfiguration = new CoreAddressConfiguration();
+      addressConfiguration.setName(name)
+         .setRoutingType(CoreAddressConfiguration.RoutingType.valueOf(routingType.toUpperCase()));
+
+      NodeList children = node.getChildNodes();
+      for (int j = 0; j < children.getLength(); j++) {
+         Node child = children.item(j);
+         if (child.getNodeName().equals("queues")) {
+            addressConfiguration.setQueueConfigurations(parseQueueConfigurations((Element) child));
+         }
+      }
+
+      for (CoreQueueConfiguration coreQueueConfiguration : addressConfiguration.getQueueConfigurations()) {
+         coreQueueConfiguration.setAddress(addressConfiguration.getName());
+         if (coreQueueConfiguration.getMaxConsumers() == null) {
+            coreQueueConfiguration.setMaxConsumers(addressConfiguration.getDefaultMaxConsumers());
+         }
+         if (coreQueueConfiguration.getDeleteOnNoConsumers() == null) {
+            coreQueueConfiguration.setDeleteOnNoConsumers(addressConfiguration.getDefaultDeleteOnNoConsumers());
+         }
+      }
+      return addressConfiguration;
    }
 
    private TransportConfiguration parseAcceptorTransportConfiguration(final Element e,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/main/resources/schema/artemis-configuration.xsd
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/resources/schema/artemis-configuration.xsd b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
index a58c33f..8da84fe 100644
--- a/artemis-server/src/main/resources/schema/artemis-configuration.xsd
+++ b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
@@ -430,7 +430,6 @@
             </xsd:complexType>
          </xsd:element>
 
-
          <!-- QUEUES -->
          <xsd:element name="queues" maxOccurs="1" minOccurs="0">
             <xsd:annotation>
@@ -863,6 +862,8 @@
                </xsd:sequence>
             </xsd:complexType>
          </xsd:element>
+
+         <xsd:element name="addresses" type="addressesType" maxOccurs="1" minOccurs="0" />
       </xsd:all>
    </xsd:complexType>
 
@@ -2520,4 +2521,79 @@
          </xsd:extension>
       </xsd:simpleContent>
    </xsd:complexType>
+
+
+   <!-- 2.0 Addressing configuration -->
+   <xsd:simpleType name="routingType">
+      <xsd:restriction base="xsd:string">
+         <xsd:enumeration value="multicast" />
+         <xsd:enumeration value="anycast" />
+      </xsd:restriction>
+   </xsd:simpleType>
+
+   <xsd:complexType name="queueType">
+      <xsd:all>
+         <xsd:element ref="filter" maxOccurs="1" minOccurs="0"/>
+         <xsd:element name="durable" type="xsd:boolean" default="true" maxOccurs="1" minOccurs="0" />
+      </xsd:all>
+      <xsd:attribute name="name" type="xsd:ID" use="required"/>
+      <xsd:attribute name="max-consumers" type="xsd:integer" use="optional"/>
+      <xsd:attribute name="delete-on-no-consumers" type="xsd:boolean" use="optional"/>
+   </xsd:complexType>
+
+   <xsd:complexType name="addressType">
+      <xsd:all>
+         <xsd:element name="queues" maxOccurs="1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+                  a list of pre configured queues to create
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:complexType>
+               <xsd:sequence>
+                  <xsd:element name="queue" type="queueType" maxOccurs="unbounded" minOccurs="0" />
+               </xsd:sequence>
+            </xsd:complexType>
+         </xsd:element>
+      </xsd:all>
+      <xsd:attribute name="name" type="xsd:string" use="required">
+         <xsd:annotation>
+            <xsd:documentation>
+               The address name to matches incoming message addresses
+            </xsd:documentation>
+         </xsd:annotation>
+      </xsd:attribute>
+      <xsd:attribute name="type" type="routingType" use="required">
+         <xsd:annotation>
+            <xsd:documentation>
+               The address name to matches incoming message addresses
+            </xsd:documentation>
+         </xsd:annotation>
+      </xsd:attribute>
+      <xsd:attribute name="default-max-consumers" type="xsd:int" use="optional" default="-1">
+         <xsd:annotation>
+            <xsd:documentation>
+               The default value of max-consumers applied to all queues that are
+               auto-created under this address.  Also applies to any queues that do not
+               specify a value for max-consumers.
+            </xsd:documentation>
+         </xsd:annotation>
+      </xsd:attribute>
+      <xsd:attribute name="default-delete-on-no-consumers" type="xsd:boolean" use="optional" default="false">
+         <xsd:annotation>
+            <xsd:documentation>
+               The default value of delete-on-no-consumers applied to all queues that are
+               auto-created under this address.  Also applies to any queues that do not
+               specify a value for delete-on-no-consumers.
+            </xsd:documentation>
+         </xsd:annotation>
+      </xsd:attribute>
+   </xsd:complexType>
+
+   <xsd:complexType name="addressesType">
+      <xsd:sequence>
+         <xsd:element name="address" type="addressType" maxOccurs="unbounded" minOccurs="0"/>
+      </xsd:sequence>
+   </xsd:complexType>
+
 </xsd:schema>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java
index 700c290..07d5f58 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java
@@ -64,6 +64,8 @@ public class DefaultsFileConfigurationTest extends ConfigurationImplTest {
 
       Assert.assertEquals(Collections.emptyList(), conf.getQueueConfigurations());
 
+      Assert.assertEquals(Collections.emptyList(), conf.getAddressConfigurations());
+
       Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultManagementAddress(), conf.getManagementAddress());
 
       Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), conf.getManagementNotificationAddress());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
index e8abcd5..b3eb5a2 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
@@ -35,6 +35,8 @@ import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.artemis.core.config.BridgeConfiguration;
 import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
+import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.config.DivertConfiguration;
 import org.apache.activemq.artemis.core.config.FileDeploymentManager;
 import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
@@ -49,6 +51,9 @@ import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
 import org.junit.Assert;
 import org.junit.Test;
 
+import static org.apache.activemq.artemis.core.config.CoreAddressConfiguration.RoutingType.ANYCAST;
+import static org.apache.activemq.artemis.core.config.CoreAddressConfiguration.RoutingType.MULTICAST;
+
 public class FileConfigurationTest extends ConfigurationImplTest {
 
    private final String fullConfigurationName = "ConfigurationTest-full-config.xml";
@@ -324,6 +329,8 @@ public class FileConfigurationTest extends ConfigurationImplTest {
       assertEquals("color='blue'", conf.getQueueConfigurations().get(1).getFilterString());
       assertEquals(false, conf.getQueueConfigurations().get(1).isDurable());
 
+      verifyAddresses();
+
       Map<String, Set<Role>> roles = conf.getSecurityRoles();
 
       assertEquals(2, roles.size());
@@ -358,6 +365,62 @@ public class FileConfigurationTest extends ConfigurationImplTest {
       assertEquals(false, conf.isJournalDatasync());
    }
 
+   private void verifyAddresses() {
+      assertEquals(2, conf.getAddressConfigurations().size());
+
+      // Addr 1
+      CoreAddressConfiguration addressConfiguration = conf.getAddressConfigurations().get(0);
+      assertEquals("addr1", addressConfiguration.getName());
+      assertEquals(ANYCAST, addressConfiguration.getRoutingType());
+      assertEquals(2, addressConfiguration.getQueueConfigurations().size());
+
+      // Addr 1 Queue 1
+      CoreQueueConfiguration queueConfiguration = addressConfiguration.getQueueConfigurations().get(0);
+
+      assertEquals("q1", queueConfiguration.getName());
+      assertFalse(queueConfiguration.isDurable());
+      assertEquals("color='blue'", queueConfiguration.getFilterString());
+      assertEquals(addressConfiguration.getDefaultDeleteOnNoConsumers(), queueConfiguration.getDeleteOnNoConsumers());
+      assertEquals("addr1", queueConfiguration.getAddress());
+      assertEquals(addressConfiguration.getDefaultMaxConsumers(), queueConfiguration.getMaxConsumers());
+
+      // Addr 1 Queue 2
+      queueConfiguration = addressConfiguration.getQueueConfigurations().get(1);
+
+      assertEquals("q2", queueConfiguration.getName());
+      assertTrue(queueConfiguration.isDurable());
+      assertEquals("color='green'", queueConfiguration.getFilterString());
+      assertEquals(new Integer(-1), queueConfiguration.getMaxConsumers());
+      assertFalse(queueConfiguration.getDeleteOnNoConsumers());
+      assertEquals("addr1", queueConfiguration.getAddress());
+
+      // Addr 2
+      addressConfiguration = conf.getAddressConfigurations().get(1);
+      assertEquals("addr2", addressConfiguration.getName());
+      assertEquals(MULTICAST, addressConfiguration.getRoutingType());
+      assertEquals(2, addressConfiguration.getQueueConfigurations().size());
+
+      // Addr 2 Queue 1
+      queueConfiguration = addressConfiguration.getQueueConfigurations().get(0);
+
+      assertEquals("q3", queueConfiguration.getName());
+      assertTrue(queueConfiguration.isDurable());
+      assertEquals("color='red'", queueConfiguration.getFilterString());
+      assertEquals(new Integer(10), queueConfiguration.getMaxConsumers());
+      assertEquals(addressConfiguration.getDefaultDeleteOnNoConsumers(), queueConfiguration.getDeleteOnNoConsumers());
+      assertEquals("addr2", queueConfiguration.getAddress());
+
+      // Addr 2 Queue 2
+      queueConfiguration = addressConfiguration.getQueueConfigurations().get(1);
+
+      assertEquals("q4", queueConfiguration.getName());
+      assertTrue(queueConfiguration.isDurable());
+      assertNull(queueConfiguration.getFilterString());
+      assertEquals(addressConfiguration.getDefaultMaxConsumers(), queueConfiguration.getMaxConsumers());
+      assertTrue(queueConfiguration.getDeleteOnNoConsumers());
+      assertEquals("addr2", queueConfiguration.getAddress());
+   }
+
    @Test
    public void testSecuritySettingPlugin() throws Exception {
       FileConfiguration fc = new FileConfiguration();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6e01d686/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
index f1b1774..87dbd90 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
@@ -290,5 +290,31 @@
             <factory-class>org.foo</factory-class>
          </connector-service>
       </connector-services>
+
+      <addresses>
+         <address name="addr1" type="anycast">
+            <queues>
+               <queue name="q1">
+                  <durable>false</durable>
+                  <filter string="color='blue'"/>
+               </queue>
+               <queue name="q2" max-consumers="-1" delete-on-no-consumers="false">
+                  <durable>true</durable>
+                  <filter string="color='green'"/>
+               </queue>
+            </queues>
+         </address>
+         <address name="addr2" type="multicast">
+            <queues>
+               <queue name="q3" max-consumers="10" >
+                  <filter string="color='red'"/>
+               </queue>
+               <queue name="q4" delete-on-no-consumers="true">
+                  <durable>true</durable>
+               </queue>
+            </queues>
+         </address>
+      </addresses>
+
    </core>
 </configuration>