ARTEMIS-789 Fix various failing tests due to addressing changes

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

Branch: refs/heads/master
Commit: 0861be14c15fef9e87235d5d56abbf1bda9f14dc
Parents: 796550d
Author: jbertram <[email protected]>
Authored: Tue Nov 15 17:10:17 2016 -0600
Committer: Martyn Taylor <[email protected]>
Committed: Fri Dec 9 18:43:15 2016 +0000

----------------------------------------------------------------------
 .../artemis/cli/commands/AbstractAction.java    |   1 -
 .../activemq/artemis/cli/commands/Create.java   |  37 ++-
 .../cli/commands/address/CreateAddress.java     |   1 -
 .../cli/commands/address/ShowAddress.java       |   3 +-
 .../artemis/cli/commands/etc/broker.xml         |   4 +-
 .../apache/activemq/cli/test/ArtemisTest.java   |  18 +-
 .../config/ActiveMQDefaultConfiguration.java    |   4 +-
 .../artemis/api/core/client/ClientSession.java  |  28 +++
 .../core/management/ActiveMQServerControl.java  |  33 ++-
 .../api/core/management/ObjectNameBuilder.java  |   2 +-
 .../core/client/impl/ClientSessionImpl.java     |  37 ++-
 .../core/impl/ActiveMQSessionContext.java       |   6 +-
 .../core/protocol/core/impl/PacketDecoder.java  |   6 +
 .../core/protocol/core/impl/PacketImpl.java     |   2 +
 .../impl/wireformat/CreateQueueMessage.java     |  26 ++-
 .../impl/wireformat/CreateQueueMessage_V2.java  |  99 ++++++++
 .../activemq/artemis/core/security/Role.java    |  23 +-
 .../spi/core/remoting/SessionContext.java       |   3 +-
 .../artemis/utils/SecurityFormatter.java        |   7 +-
 .../src/test/scripts/validate-instalation.sh    |   4 +-
 artemis-features/src/main/resources/artemis.xml |   4 +-
 .../jms/client/ActiveMQMessageProducer.java     |   2 +-
 .../artemis/jms/client/ActiveMQSession.java     |   9 +-
 .../jms/server/impl/JMSServerManagerImpl.java   |   4 +-
 .../protocol/openwire/OpenWireConnection.java   |   1 -
 .../core/protocol/openwire/amq/AMQSession.java  |   2 +-
 .../core/protocol/stomp/StompConnection.java    |  26 ++-
 .../deployers/impl/FileConfigurationParser.java |  26 +++
 .../impl/ActiveMQServerControlImpl.java         |  91 ++++++--
 .../core/persistence/config/PersistedRoles.java |  29 ++-
 .../journal/AbstractJournalStorageManager.java  |   1 +
 .../core/postoffice/impl/PostOfficeImpl.java    |   4 +-
 .../core/ServerSessionPacketHandler.java        |  13 +-
 .../artemis/core/server/ActiveMQServer.java     |   1 -
 .../artemis/core/server/ServerSession.java      |   2 +-
 .../core/server/impl/ActiveMQServerImpl.java    |  27 ++-
 .../artemis/core/server/impl/AddressInfo.java   |  11 +
 .../impl/AutoCreatedQueueManagerImpl.java       |   8 +-
 .../artemis/core/server/impl/QueueImpl.java     |   2 +-
 .../core/server/impl/ServerSessionImpl.java     |   7 +-
 .../core/settings/impl/AddressSettings.java     | 167 +++++++++++--
 .../resources/schema/artemis-configuration.xsd  |  43 +++-
 .../core/config/impl/FileConfigurationTest.java |   4 +-
 .../artemis/core/security/RoleTest.java         |  20 +-
 .../core/settings/AddressSettingsTest.java      |  10 +-
 .../artemis/core/settings/RepositoryTest.java   |  14 +-
 .../resources/ConfigurationTest-full-config.xml |   8 +
 artemis-tools/pom.xml                           |   2 +-
 docs/user-manual/en/queue-attributes.md         |  32 ++-
 .../clustered-durable-subscription/readme.html  |   1 -
 .../ClusteredDurableSubscriptionExample.java    |   2 +
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../clustered/clustered-grouping/readme.html    |   2 -
 .../main/resources/activemq/server0/broker.xml  |   5 +-
 .../main/resources/activemq/server1/broker.xml  |   5 +-
 .../main/resources/activemq/server2/broker.xml  |   5 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../clustered/clustered-queue/readme.html       |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../clustered-static-discovery-uri/readme.html  |   1 -
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server1/broker.xml  |   2 +-
 .../main/resources/activemq/server2/broker.xml  |   2 +-
 .../main/resources/activemq/server3/broker.xml  |   2 +-
 .../clustered-static-discovery/readme.html      |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server2/broker.xml  |   3 +-
 .../main/resources/activemq/server3/broker.xml  |   3 +-
 .../clustered-static-oneway/readme.html         |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server2/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server1/broker.xml  |   2 +-
 .../clustered/clustered-topic/readme.html       |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   5 +-
 .../main/resources/activemq/server1/broker.xml  |   5 +-
 .../clustered/symmetric-cluster/readme.html     |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server2/broker.xml  |   3 +-
 .../main/resources/activemq/server3/broker.xml  |   3 +-
 .../main/resources/activemq/server4/broker.xml  |   3 +-
 .../main/resources/activemq/server5/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   9 +-
 .../main/resources/activemq/server1/broker.xml  |   9 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   1 -
 .../main/resources/activemq/server1/broker.xml  |   1 -
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server2/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   7 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   3 +-
 .../main/resources/activemq/server1/broker.xml  |   3 +-
 .../main/resources/activemq/server0/broker.xml  |  10 +-
 .../main/resources/activemq/server1/broker.xml  |   2 +-
 examples/features/standard/cdi/pom.xml          |  12 +
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |  18 +-
 .../main/resources/activemq/server1/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server1/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../jms/example/LargeMessageExample.java        |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../artemis/jms/example/ManagementExample.java  |  10 +-
 .../main/resources/activemq/server0/broker.xml  |   8 +-
 .../main/resources/activemq/server0/broker.xml  |   8 +-
 .../main/resources/activemq/server0/broker.xml  |   8 +-
 .../jms/example/PreacknowledgeExample.java      |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   6 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../main/resources/activemq/server0/broker.xml  |   4 +-
 .../main/resources/activemq/server0/broker.xml  |   8 +-
 .../artemis/jms/example/ProtonCPPExample.java   |   3 +-
 .../main/resources/activemq/server0/broker.xml  |   2 +-
 .../integration/addressing/AddressingTest.java  |   6 +-
 .../integration/amqp/AmqpClientTestSupport.java |   2 +-
 .../integration/cli/AddressCommandTest.java     |   4 -
 .../tests/integration/cli/QueueCommandTest.java |   4 +-
 .../client/AutoCreateJmsDestinationTest.java    |   4 +-
 .../tests/integration/client/SessionTest.java   |   3 +-
 .../cluster/failover/SecurityFailoverTest.java  |   2 +-
 .../crossprotocol/AMQPToOpenwireTest.java       |   2 +-
 .../crossprotocol/OpenWireToAMQPTest.java       |   2 +-
 .../interceptors/InterceptorTest.java           |   8 +-
 .../jms/cluster/AutoCreateQueueClusterTest.java |  10 +-
 .../jms/cluster/TemporaryQueueClusterTest.java  |   2 +-
 .../jms/jms2client/NonExistentQueueTest.java    |   4 +-
 .../management/ActiveMQServerControlTest.java   |   4 +-
 .../ActiveMQServerControlUsingCoreTest.java     |  42 +++-
 .../management/AddressControlTest.java          |   4 +-
 .../management/AddressControlUsingCoreTest.java |   2 +-
 .../management/ManagementWithStompTest.java     | 232 -------------------
 ...tyManagementWithConfiguredAdminUserTest.java |   4 +-
 .../management/SecurityNotificationTest.java    |   4 +-
 .../mqtt/imported/MQTTTestSupport.java          |   3 +-
 .../integration/openwire/OpenWireTestBase.java  |  10 +-
 .../openwire/SimpleOpenWireTest.java            |  21 +-
 .../RolesConfigurationStorageTest.java          |  10 +-
 .../ra/ActiveMQMessageHandlerSecurityTest.java  |   2 +-
 .../tests/integration/ra/JMSContextTest.java    |   2 +-
 .../integration/ra/OutgoingConnectionTest.java  |   2 +-
 .../ra/OutgoingConnectionTestJTA.java           |   2 +-
 .../integration/security/LDAPSecurityTest.java  |   4 +-
 .../integration/security/SecurityTest.java      | 102 ++++----
 .../integration/server/ResourceLimitTest.java   |   2 +-
 .../integration/ssl/DualAuthenticationTest.java |   4 +-
 .../tests/integration/stomp/StompTest.java      |  58 +++++
 .../tests/integration/stomp/StompTestBase.java  |   8 +-
 .../integration/stomp/v12/StompV12Test.java     |   7 +-
 .../tests/util/JMSClusteredTestBase.java        |   2 -
 .../src/test/resources/reload-test-jms.xml      |   2 +-
 .../test/resources/reload-test-updated-jms.xml  |   2 +-
 .../artemis/jms/tests/MessageProducerTest.java  |   4 +-
 .../activemq/artemis/jms/tests/SessionTest.java |  13 +-
 .../jms/tests/message/MessageHeaderTest.java    |  30 ++-
 .../jms/conform/session/TopicSessionTest.java   |   2 +
 .../impl/ActiveMQSecurityManagerImplTest.java   |  28 +--
 190 files changed, 1178 insertions(+), 763 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java
 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java
index b4dbba8..3619ed7 100644
--- 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java
+++ 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java
@@ -16,7 +16,6 @@
  */
 package org.apache.activemq.artemis.cli.commands;
 
-import io.airlift.airline.Option;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientRequestor;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
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 1ae82b3..ff2753a 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
@@ -197,11 +197,11 @@ public class Create extends InputAbstract {
    @Option(name = "--no-web", description = "This will remove the web server 
definition from bootstrap.xml")
    boolean noWeb;
 
-   @Option(name = "--queues", description = "comma separated list of jms 
queues.")
+   @Option(name = "--queues", description = "comma separated list of queues.")
    String queues;
 
-   @Option(name = "--topics", description = "comma separated list of jms 
topics ")
-   String topics;
+   @Option(name = "--addresses", description = "comma separated list of 
addresses ")
+   String addresses;
 
    @Option(name = "--aio", description = "Force aio journal on the 
configuration regardless of the library being available or not.")
    boolean forceLibaio;
@@ -632,7 +632,7 @@ public class Create extends InputAbstract {
          filters.put("${cluster-password}", "");
       }
 
-      applyJMSObjects(filters);
+      applyAddressesAndQueues(filters);
 
       if (home != null) {
          filters.put("${home}", path(home, false));
@@ -784,12 +784,33 @@ public class Create extends InputAbstract {
       for (String str : getQueueList()) {
          printWriter.println("      <queue name=\"" + str + "\"/>");
       }
-      for (String str : getTopicList()) {
+      for (String str : getAddressList()) {
          printWriter.println("      <topic name=\"" + str + "\"/>");
       }
       filters.put("${jms-list.settings}", writer.toString());
    }
 
+   /**
+    * It will create the address and queue configurations
+    */
+   private void applyAddressesAndQueues(HashMap<String, String> filters) {
+      StringWriter writer = new StringWriter();
+      PrintWriter printWriter = new PrintWriter(writer);
+      printWriter.println();
+
+      for (String str : getQueueList()) {
+         printWriter.println("         <address name=\"" + str + "\" 
type=\"anycast\">");
+         printWriter.println("            <queues>");
+         printWriter.println("               <queue name=\"" + str + "\" />");
+         printWriter.println("            </queues>");
+         printWriter.println("         </address>");
+      }
+      for (String str : getAddressList()) {
+         printWriter.println("         <address name=\"" + str + "\" 
type=\"multicast\"/>");
+      }
+      filters.put("${address-queue.settings}", writer.toString());
+   }
+
    private void performAutoTune(HashMap<String, String> filters, boolean aio, 
File dataFolder) {
       if (noAutoTune) {
          filters.put("${journal-buffer.settings}", "");
@@ -862,11 +883,11 @@ public class Create extends InputAbstract {
       }
    }
 
-   private String[] getTopicList() {
-      if (topics == null) {
+   private String[] getAddressList() {
+      if (addresses == null) {
          return new String[0];
       } else {
-         return topics.split(",");
+         return addresses.split(",");
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
index 6c92dc6..86aafaf 100644
--- 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
+++ 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
@@ -23,7 +23,6 @@ import 
org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.cli.commands.AbstractAction;
 import org.apache.activemq.artemis.cli.commands.ActionContext;
-import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 
 @Command(name = "create", description = "create an address")
 public class CreateAddress extends AbstractAction {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
index 34331bb..013b504 100644
--- 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
+++ 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
@@ -46,8 +46,7 @@ public class ShowAddress extends AbstractAction {
          public void setUpInvocation(ClientMessage message) throws Exception {
             if (bindings) {
                ManagementHelper.putOperationInvocation(message, "broker", 
"listBindingsForAddress", getName());
-            }
-            else {
+            } else {
                ManagementHelper.putOperationInvocation(message, "broker", 
"getAddressInfo", getName());
             }
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
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 0871ab6..6c7f91c 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
@@ -74,6 +74,8 @@ 
${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
             <permission type="deleteNonDurableQueue" roles="${role}"/>
             <permission type="createDurableQueue" roles="${role}"/>
             <permission type="deleteDurableQueue" roles="${role}"/>
+            <permission type="createAddress" roles="${role}"/>
+            <permission type="deleteAddress" roles="${role}"/>
             <permission type="consume" roles="${role}"/>
             <permission type="browse" roles="${role}"/>
             <permission type="send" roles="${role}"/>
@@ -105,7 +107,7 @@ 
${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
             <queues>
                <queue name="ExpiryQueue" />
             </queues>
-         </address>
+         </address>${address-queue.settings}
       </addresses>
 
    </core>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java 
b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index 3c03ab2..85d194a 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -533,20 +533,20 @@ public class ArtemisTest {
       File instanceFolder = temporaryFolder.newFolder(folderName);
 
       setupAuth(instanceFolder);
-      String queues = "q1,t2";
-      String topics = "t1,t2";
+      String queues = "q1,q2";
+      String addresses = "a1,a2";
 
 
       // This is usually set when run from the command line via artemis.profile
-      Run.setEmbedded(false);
-      Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", 
"--silent", "--no-web", "--queues", queues, "--topics", topics, 
"--no-autotune", "--require-login");
+      Run.setEmbedded(true);
+      Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", 
"--silent", "--no-web", "--queues", queues, "--addresses", addresses, 
"--no-autotune", "--require-login");
       System.setProperty("artemis.instance", instanceFolder.getAbsolutePath());
 
       // Some exceptions may happen on the initialization, but they should be 
ok on start the basic core protocol
       Artemis.internalExecute("run");
 
-      Artemis.main("queue", "create", "--name", "q1", "--address", "q1", 
"--user", "admin", "--password", "admin");
-      Artemis.main("queue", "create", "--name", "t2", "--address", "t2", 
"--user", "admin", "--password", "admin");
+//      Artemis.main("queue", "create", "--name", "q1", "--address", "q1", 
"--user", "admin", "--password", "admin", "--autoCreateAddress");
+//      Artemis.main("queue", "create", "--name", "t2", "--address", "t2", 
"--user", "admin", "--password", "admin", "--autoCreateAddress");
 
       try {
          try (ServerLocator locator = 
ServerLocatorImpl.newLocator("tcp://localhost:61616");
@@ -556,9 +556,9 @@ public class ArtemisTest {
                ClientSession.QueueQuery queryResult = 
coreSession.queueQuery(SimpleString.toSimpleString(str));
                assertTrue("Couldn't find queue " + str, 
queryResult.isExists());
             }
-            for (String str : topics.split(",")) {
-               ClientSession.QueueQuery queryResult = 
coreSession.queueQuery(SimpleString.toSimpleString(str));
-               assertTrue("Couldn't find topic " + str, 
queryResult.isExists());
+            for (String str : addresses.split(",")) {
+               ClientSession.AddressQuery queryResult = 
coreSession.addressQuery(SimpleString.toSimpleString(str));
+               assertTrue("Couldn't find address " + str, 
queryResult.isExists());
             }
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/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 e9212f2..6fb5580 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
@@ -162,8 +162,8 @@ public final class ActiveMQDefaultConfiguration {
    // the name of the address that consumers bind to receive management 
notifications
    private static SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new 
SimpleString("activemq.notifications");
 
-   // The default address used for clustering
-   private static String DEFAULT_CLUSTER_ADDRESS = "jms";
+   // The default address used for clustering, empty string means all addresses
+   private static String DEFAULT_CLUSTER_ADDRESS = "";
 
    // Cluster username. It applies to all cluster configurations.
    private static String DEFAULT_CLUSTER_USER = "ACTIVEMQ.CLUSTER.ADMIN.USER";

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
index 35bc9f9..72b1a11 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
@@ -294,6 +294,34 @@ public interface ClientSession extends XAResource, 
AutoCloseable {
    void createQueue(String address, String queueName, String filter, boolean 
durable) throws ActiveMQException;
 
    /**
+    * Creates a <em>non-temporary</em> queue.
+    *
+    * @param address     the queue will be bound to this address
+    * @param queueName   the name of the queue
+    * @param filter      only messages which match this filter will be put in 
the queue
+    * @param durable     whether the queue is durable or not
+    * @param autoCreated whether to mark this queue as autoCreated or not
+    * @throws ActiveMQException in an exception occurs while creating the queue
+    */
+   void createQueue(SimpleString address,
+                    SimpleString queueName,
+                    SimpleString filter,
+                    boolean durable,
+                    boolean autoCreated) throws ActiveMQException;
+
+   /**
+    * Creates a <em>non-temporary</em>queue.
+    *
+    * @param address     the queue will be bound to this address
+    * @param queueName   the name of the queue
+    * @param filter      only messages which match this filter will be put in 
the queue
+    * @param durable     whether the queue is durable or not
+    * @param autoCreated whether to mark this queue as autoCreated or not
+    * @throws ActiveMQException in an exception occurs while creating the queue
+    */
+   void createQueue(String address, String queueName, String filter, boolean 
durable, boolean autoCreated) throws ActiveMQException;
+
+   /**
     * Creates a <em>temporary</em> queue.
     *
     * @param address   the queue will be bound to this address

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
index 0654dbf..33584bf 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
@@ -811,7 +811,8 @@ public interface ActiveMQServerControl {
                             @Parameter(desc = "a comma-separated list of roles 
allowed to delete non durable queues", name = "deleteNonDurableQueueRoles") 
String deleteNonDurableQueueRoles,
                             @Parameter(desc = "a comma-separated list of roles 
allowed to send management messages messages", name = "manage") String 
manageRoles,
                             @Parameter(desc = "a comma-separated list of roles 
allowed to browse queues", name = "browse") String browseRoles,
-                            @Parameter(desc = "a comma-separated list of roles 
allowed to create addresses", name = "createAddressRoles") String 
createAddressRoles) throws Exception;
+                            @Parameter(desc = "a comma-separated list of roles 
allowed to create addresses", name = "createAddressRoles") String 
createAddressRoles,
+                            @Parameter(desc = "a comma-separated list of roles 
allowed to delete addresses", name = "deleteAddressRoles") String 
deleteAddressRoles) throws Exception;
 
    @Operation(desc = "Remove security settings for an address", impact = 
MBeanOperationInfo.ACTION)
    void removeSecuritySettings(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch) throws Exception;
@@ -848,6 +849,36 @@ public interface ActiveMQServerControl {
                            @Parameter(desc = "allow auto-created queues to be 
deleted automatically", name = "autoDeleteJmsQueues") boolean 
autoDeleteJmsQueues,
                            @Parameter(desc = "allow topics to be created 
automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics,
                            @Parameter(desc = "allow auto-created topics to be 
deleted automatically", name = "autoDeleteJmsTopics") boolean 
autoDeleteJmsTopics) throws Exception;
+   /**
+    * adds a new address setting for a specific address
+    */
+   @Operation(desc = "Add address settings for addresses matching the 
addressMatch", impact = MBeanOperationInfo.ACTION)
+   void addAddressSettings(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch,
+                           @Parameter(desc = "the dead letter address 
setting", name = "DLA") String DLA,
+                           @Parameter(desc = "the expiry address setting", 
name = "expiryAddress") String expiryAddress,
+                           @Parameter(desc = "the expiry delay setting", name 
= "expiryDelay") long expiryDelay,
+                           @Parameter(desc = "are any queues created for this 
address a last value queue", name = "lastValueQueue") boolean lastValueQueue,
+                           @Parameter(desc = "the delivery attempts", name = 
"deliveryAttempts") int deliveryAttempts,
+                           @Parameter(desc = "the max size in bytes", name = 
"maxSizeBytes") long maxSizeBytes,
+                           @Parameter(desc = "the page size in bytes", name = 
"pageSizeBytes") int pageSizeBytes,
+                           @Parameter(desc = "the max number of pages in the 
soft memory cache", name = "pageMaxCacheSize") int pageMaxCacheSize,
+                           @Parameter(desc = "the redelivery delay", name = 
"redeliveryDelay") long redeliveryDelay,
+                           @Parameter(desc = "the redelivery delay 
multiplier", name = "redeliveryMultiplier") double redeliveryMultiplier,
+                           @Parameter(desc = "the maximum redelivery delay", 
name = "maxRedeliveryDelay") long maxRedeliveryDelay,
+                           @Parameter(desc = "the redistribution delay", name 
= "redistributionDelay") long redistributionDelay,
+                           @Parameter(desc = "do we send to the DLA when there 
is no where to route the message", name = "sendToDLAOnNoRoute") boolean 
sendToDLAOnNoRoute,
+                           @Parameter(desc = "the policy to use when the 
address is full", name = "addressFullMessagePolicy") String 
addressFullMessagePolicy,
+                           @Parameter(desc = "when a consumer falls below this 
threshold in terms of messages consumed per second it will be considered 
'slow'", name = "slowConsumerThreshold") long slowConsumerThreshold,
+                           @Parameter(desc = "how often (in seconds) to check 
for slow consumers", name = "slowConsumerCheckPeriod") long 
slowConsumerCheckPeriod,
+                           @Parameter(desc = "the policy to use when a slow 
consumer is detected", name = "slowConsumerPolicy") String slowConsumerPolicy,
+                           @Parameter(desc = "allow jms queues to be created 
automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues,
+                           @Parameter(desc = "allow auto-created jms queues to 
be deleted automatically", name = "autoDeleteJmsQueues") boolean 
autoDeleteJmsQueues,
+                           @Parameter(desc = "allow jms topics to be created 
automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics,
+                           @Parameter(desc = "allow auto-created jms topics to 
be deleted automatically", name = "autoDeleteJmsTopics") boolean 
autoDeleteJmsTopics,
+                           @Parameter(desc = "allow queues to be created 
automatically", name = "autoCreateQueues") boolean autoCreateQueues,
+                           @Parameter(desc = "allow auto-created queues to be 
deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues,
+                           @Parameter(desc = "allow topics to be created 
automatically", name = "autoCreateAddresses") boolean autoCreateAddresses,
+                           @Parameter(desc = "allow auto-created topics to be 
deleted automatically", name = "autoDeleteAddresses") boolean 
autoDeleteAddresses) throws Exception;
 
    void removeAddressSettings(String addressMatch) throws Exception;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java
index 019996a..3bbd456 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java
@@ -165,7 +165,7 @@ public final class ObjectNameBuilder {
     * Returns the ObjectName used by JMSQueueControl.
     */
    public ObjectName getJMSQueueObjectName(final String name) throws Exception 
{
-      return createObjectName("Queue", name);
+      return getQueueObjectName(SimpleString.toSimpleString(name), 
SimpleString.toSimpleString(name));
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
index 16311b0..145ca99 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
@@ -237,14 +237,14 @@ public final class ClientSessionImpl implements 
ClientSessionInternal, FailureLi
 
    @Override
    public void createQueue(final SimpleString address, final SimpleString 
queueName) throws ActiveMQException {
-      internalCreateQueue(address, queueName, null, false, false);
+      internalCreateQueue(address, queueName, null, false, false, false);
    }
 
    @Override
    public void createQueue(final SimpleString address,
                            final SimpleString queueName,
                            final boolean durable) throws ActiveMQException {
-      internalCreateQueue(address, queueName, null, durable, false);
+      internalCreateQueue(address, queueName, null, durable, false, false);
    }
 
    @Override
@@ -295,7 +295,7 @@ public final class ClientSessionImpl implements 
ClientSessionInternal, FailureLi
                            final SimpleString queueName,
                            final SimpleString filterString,
                            final boolean durable) throws ActiveMQException {
-      internalCreateQueue(address, queueName, filterString, durable, false);
+      internalCreateQueue(address, queueName, filterString, durable, false, 
false);
    }
 
    @Override
@@ -307,27 +307,45 @@ public final class ClientSessionImpl implements 
ClientSessionInternal, FailureLi
    }
 
    @Override
+   public void createQueue(final SimpleString address,
+                           final SimpleString queueName,
+                           final SimpleString filterString,
+                           final boolean durable,
+                           final boolean autoCreated) throws ActiveMQException 
{
+      internalCreateQueue(address, queueName, filterString, durable, false, 
autoCreated);
+   }
+
+   @Override
+   public void createQueue(final String address,
+                           final String queueName,
+                           final String filterString,
+                           final boolean durable,
+                           final boolean autoCreated) throws ActiveMQException 
{
+      createQueue(SimpleString.toSimpleString(address), 
SimpleString.toSimpleString(queueName), 
SimpleString.toSimpleString(filterString), durable, autoCreated);
+   }
+
+   @Override
    public void createTemporaryQueue(final SimpleString address, final 
SimpleString queueName) throws ActiveMQException {
-      internalCreateQueue(address, queueName, null, false, true);
+      internalCreateQueue(address, queueName, null, false, true, false);
    }
 
    @Override
    public void createTemporaryQueue(final String address, final String 
queueName) throws ActiveMQException {
-      internalCreateQueue(SimpleString.toSimpleString(address), 
SimpleString.toSimpleString(queueName), null, false, true);
+      internalCreateQueue(SimpleString.toSimpleString(address), 
SimpleString.toSimpleString(queueName), null, false, true, false);
    }
 
    @Override
    public void createTemporaryQueue(final SimpleString address,
                                     final SimpleString queueName,
                                     final SimpleString filter) throws 
ActiveMQException {
-      internalCreateQueue(address, queueName, filter, false, true);
+      internalCreateQueue(address, queueName, filter, false, true, false);
    }
 
    @Override
    public void createTemporaryQueue(final String address,
                                     final String queueName,
                                     final String filter) throws 
ActiveMQException {
-      internalCreateQueue(SimpleString.toSimpleString(address), 
SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), 
false, true);
+      internalCreateQueue(SimpleString.toSimpleString(address), 
SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), 
false, true, false);
    }
 
    @Override
@@ -1551,7 +1569,8 @@ public final class ClientSessionImpl implements 
ClientSessionInternal, FailureLi
                                     final SimpleString queueName,
                                     final SimpleString filterString,
                                     final boolean durable,
-                                    final boolean temp) throws 
ActiveMQException {
+                                    final boolean temp,
+                                    final boolean autoCreated) throws 
ActiveMQException {
       checkClosed();
 
       if (durable && temp) {
@@ -1560,7 +1579,7 @@ public final class ClientSessionImpl implements 
ClientSessionInternal, FailureLi
 
       startCall();
       try {
-         sessionContext.createQueue(address, queueName, filterString, durable, 
temp);
+         sessionContext.createQueue(address, queueName, filterString, durable, 
temp, autoCreated);
       } finally {
          endCall();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
index 919da19..cbbe2b7 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
@@ -52,6 +52,7 @@ import org.apache.activemq.artemis.core.protocol.core.Packet;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.DisconnectConsumerMessage;
@@ -594,8 +595,9 @@ public class ActiveMQSessionContext extends SessionContext {
                            SimpleString queueName,
                            SimpleString filterString,
                            boolean durable,
-                           boolean temp) throws ActiveMQException {
-      CreateQueueMessage request = new CreateQueueMessage(address, queueName, 
filterString, durable, temp, true);
+                           boolean temp,
+                           boolean autoCreated) throws ActiveMQException {
+      CreateQueueMessage request = new CreateQueueMessage_V2(address, 
queueName, filterString, durable, temp, autoCreated, true);
       sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
index 834822c..de1edbc 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
@@ -29,6 +29,7 @@ import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterTop
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterTopologyChangeMessage_V3;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
 import 
org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage;
@@ -91,6 +92,7 @@ import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CRE
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP;
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_ADDRESS;
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE_V2;
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_SHARED_QUEUE;
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
 import static 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DISCONNECT;
@@ -245,6 +247,10 @@ public abstract class PacketDecoder implements 
Serializable {
             packet = new CreateQueueMessage();
             break;
          }
+         case CREATE_QUEUE_V2: {
+            packet = new CreateQueueMessage_V2();
+            break;
+         }
          case CREATE_SHARED_QUEUE: {
             packet = new CreateSharedQueueMessage();
             break;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
index e07d9b5..abc1eef 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
@@ -251,6 +251,8 @@ public class PacketImpl implements Packet {
 
    public static final byte CREATE_ADDRESS = -11;
 
+   public static final byte CREATE_QUEUE_V2 = -12;
+
    // Static --------------------------------------------------------
 
    public PacketImpl(final byte type) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java
index e837d55..2ebf147 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java
@@ -22,17 +22,17 @@ import 
org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
 
 public class CreateQueueMessage extends PacketImpl {
 
-   private SimpleString address;
+   protected SimpleString address;
 
-   private SimpleString queueName;
+   protected SimpleString queueName;
 
-   private SimpleString filterString;
+   protected SimpleString filterString;
 
-   private boolean durable;
+   protected boolean durable;
 
-   private boolean temporary;
+   protected boolean temporary;
 
-   private boolean requiresResponse;
+   protected boolean requiresResponse;
 
    public CreateQueueMessage(final SimpleString address,
                              final SimpleString queueName,
@@ -55,16 +55,28 @@ public class CreateQueueMessage extends PacketImpl {
    }
 
    // Public --------------------------------------------------------
+   /**
+    * @param createQueueMessageV2
+    */
+   public CreateQueueMessage(byte createQueueMessageV2) {
+      super(createQueueMessageV2);
+   }
 
    @Override
    public String toString() {
       StringBuffer buff = new StringBuffer(getParentString());
+      buff.append("]");
+      return buff.toString();
+   }
+
+   @Override
+   public String getParentString() {
+      StringBuffer buff = new StringBuffer(super.getParentString());
       buff.append(", address=" + address);
       buff.append(", queueName=" + queueName);
       buff.append(", filterString=" + filterString);
       buff.append(", durable=" + durable);
       buff.append(", temporary=" + temporary);
-      buff.append("]");
       return buff.toString();
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java
new file mode 100644
index 0000000..13a4a58
--- /dev/null
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java
@@ -0,0 +1,99 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.SimpleString;
+
+public class CreateQueueMessage_V2 extends CreateQueueMessage {
+
+   private boolean autoCreated;
+
+   public CreateQueueMessage_V2(final SimpleString address,
+                                final SimpleString queueName,
+                                final SimpleString filterString,
+                                final boolean durable,
+                                final boolean temporary,
+                                final boolean autoCreated,
+                                final boolean requiresResponse) {
+      this();
+
+      this.address = address;
+      this.queueName = queueName;
+      this.filterString = filterString;
+      this.durable = durable;
+      this.temporary = temporary;
+      this.autoCreated = autoCreated;
+      this.requiresResponse = requiresResponse;
+   }
+
+   public CreateQueueMessage_V2() {
+      super(CREATE_QUEUE_V2);
+   }
+
+   // Public --------------------------------------------------------
+
+   @Override
+   public String toString() {
+      StringBuffer buff = new StringBuffer(super.getParentString());
+      buff.append(", autoCreated=" + autoCreated);
+      buff.append("]");
+      return buff.toString();
+   }
+
+   public boolean isAutoCreated() {
+      return autoCreated;
+   }
+
+   public void setAutoCreated(boolean autoCreated) {
+      this.autoCreated = autoCreated;
+   }
+
+   @Override
+   public void encodeRest(final ActiveMQBuffer buffer) {
+      super.encodeRest(buffer);
+      buffer.writeBoolean(autoCreated);
+   }
+
+   @Override
+   public void decodeRest(final ActiveMQBuffer buffer) {
+      super.decodeRest(buffer);
+      autoCreated = buffer.readBoolean();
+   }
+
+   @Override
+   public int hashCode() {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (autoCreated ? 1231 : 1237);
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof CreateQueueMessage_V2))
+         return false;
+      CreateQueueMessage_V2 other = (CreateQueueMessage_V2) obj;
+      if (autoCreated != other.autoCreated)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java
index 2792d52..a3b4c21 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java
@@ -36,6 +36,8 @@ public class Role implements Serializable {
 
    private final boolean createAddress;
 
+   private final boolean deleteAddress;
+
    private final boolean createDurableQueue;
 
    private final boolean deleteDurableQueue;
@@ -49,7 +51,7 @@ public class Role implements Serializable {
    private final boolean browse;
 
    public JsonObject toJson() {
-      return JsonLoader.createObjectBuilder().add("name", name).add("send", 
send).add("consume", consume).add("createDurableQueue", 
createDurableQueue).add("deleteDurableQueue", 
deleteDurableQueue).add("createNonDurableQueue", 
createNonDurableQueue).add("deleteNonDurableQueue", 
deleteNonDurableQueue).add("manage", manage).add("browse", 
browse).add("createAddress", createAddress).build();
+      return JsonLoader.createObjectBuilder().add("name", name).add("send", 
send).add("consume", consume).add("createDurableQueue", 
createDurableQueue).add("deleteDurableQueue", 
deleteDurableQueue).add("createNonDurableQueue", 
createNonDurableQueue).add("deleteNonDurableQueue", 
deleteNonDurableQueue).add("manage", manage).add("browse", 
browse).add("createAddress", createAddress).add("deleteAddress", 
deleteAddress).build();
    }
 
    /**
@@ -87,8 +89,8 @@ public class Role implements Serializable {
                final boolean manage,
                final boolean browse) {
       // This constructor exists for version compatibility on the API. If 
either createDurableQueue or createNonDurableQueue
-      // is true then createAddress will be true.
-      this(name, send, consume, createDurableQueue, deleteDurableQueue, 
createNonDurableQueue, deleteNonDurableQueue, manage, browse, 
createDurableQueue || createNonDurableQueue);
+      // is true then createAddress will be true. If either deleteDurableQueue 
or deleteNonDurableQueue is true then deleteAddress will be true.
+      this(name, send, consume, createDurableQueue, deleteDurableQueue, 
createNonDurableQueue, deleteNonDurableQueue, manage, browse, 
createDurableQueue || createNonDurableQueue, deleteDurableQueue || 
deleteNonDurableQueue);
    }
 
    public Role(final String name,
@@ -100,7 +102,8 @@ public class Role implements Serializable {
                final boolean deleteNonDurableQueue,
                final boolean manage,
                final boolean browse,
-               final boolean createAddress) {
+               final boolean createAddress,
+               final boolean deleteAddress) {
       if (name == null) {
          throw new NullPointerException("name is null");
       }
@@ -108,6 +111,7 @@ public class Role implements Serializable {
       this.send = send;
       this.consume = consume;
       this.createAddress = createAddress;
+      this.deleteAddress = deleteAddress;
       this.createDurableQueue = createDurableQueue;
       this.deleteDurableQueue = deleteDurableQueue;
       this.createNonDurableQueue = createNonDurableQueue;
@@ -132,6 +136,10 @@ public class Role implements Serializable {
       return createAddress;
    }
 
+   public boolean isDeleteAddress() {
+      return deleteAddress;
+   }
+
    public boolean isCreateDurableQueue() {
       return createDurableQueue;
    }
@@ -161,6 +169,9 @@ public class Role implements Serializable {
       if (createAddress) {
          stringReturn.append(" createAddress ");
       }
+      if (deleteAddress) {
+         stringReturn.append(" deleteAddress ");
+      }
       if (createDurableQueue) {
          stringReturn.append(" createDurableQueue ");
       }
@@ -202,6 +213,9 @@ public class Role implements Serializable {
       if (createAddress != role.createAddress) {
          return false;
       }
+      if (deleteAddress != role.deleteAddress) {
+         return false;
+      }
       if (createDurableQueue != role.createDurableQueue) {
          return false;
       }
@@ -237,6 +251,7 @@ public class Role implements Serializable {
       result = 31 * result + (send ? 1 : 0);
       result = 31 * result + (consume ? 1 : 0);
       result = 31 * result + (createAddress ? 1 : 0);
+      result = 31 * result + (deleteAddress ? 1 : 0);
       result = 31 * result + (createDurableQueue ? 1 : 0);
       result = 31 * result + (deleteDurableQueue ? 1 : 0);
       result = 31 * result + (createNonDurableQueue ? 1 : 0);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
index 16e8314..01f0b08 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
@@ -172,7 +172,8 @@ public abstract class SessionContext {
                                     SimpleString queueName,
                                     SimpleString filterString,
                                     boolean durable,
-                                    boolean temp) throws ActiveMQException;
+                                    boolean temp,
+                                    boolean autoCreated) throws 
ActiveMQException;
 
    public abstract ClientSession.QueueQuery queueQuery(SimpleString queueName) 
throws ActiveMQException;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java
index 7e9ff32..08c414d 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java
@@ -33,7 +33,8 @@ public class SecurityFormatter {
                                           String deleteNonDurableQueueRoles,
                                           String manageRoles,
                                           String browseRoles,
-                                          String createAddressRoles) {
+                                          String createAddressRoles,
+                                          String deleteAddressRoles) {
       List<String> createDurableQueue = toList(createDurableQueueRoles);
       List<String> deleteDurableQueue = toList(deleteDurableQueueRoles);
       List<String> createNonDurableQueue = toList(createNonDurableQueueRoles);
@@ -43,6 +44,7 @@ public class SecurityFormatter {
       List<String> manage = toList(manageRoles);
       List<String> browse = toList(browseRoles);
       List<String> createAddress = toList(createAddressRoles);
+      List<String> deleteAddress = toList(deleteAddressRoles);
 
       Set<String> allRoles = new HashSet<>();
       allRoles.addAll(createDurableQueue);
@@ -54,10 +56,11 @@ public class SecurityFormatter {
       allRoles.addAll(manage);
       allRoles.addAll(browse);
       allRoles.addAll(createAddress);
+      allRoles.addAll(deleteAddress);
 
       Set<Role> roles = new HashSet<>(allRoles.size());
       for (String role : allRoles) {
-         roles.add(new Role(role, send.contains(role), consume.contains(role), 
createDurableQueue.contains(role), deleteDurableQueue.contains(role), 
createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), 
manageRoles.contains(role), browse.contains(role), 
createAddressRoles.contains(role)));
+         roles.add(new Role(role, send.contains(role), consume.contains(role), 
createDurableQueue.contains(role), deleteDurableQueue.contains(role), 
createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), 
manageRoles.contains(role), browse.contains(role), 
createAddressRoles.contains(role), deleteAddressRoles.contains(role)));
       }
       return roles;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-distribution/src/test/scripts/validate-instalation.sh
----------------------------------------------------------------------
diff --git a/artemis-distribution/src/test/scripts/validate-instalation.sh 
b/artemis-distribution/src/test/scripts/validate-instalation.sh
index 85773a4..5837739 100755
--- a/artemis-distribution/src/test/scripts/validate-instalation.sh
+++ b/artemis-distribution/src/test/scripts/validate-instalation.sh
@@ -49,7 +49,7 @@ pwd
 sleep 5
 
 ./artemis producer
-./artemis consumer
+./artemis consumer --receive-timeout 10000 --break-on-null
 
 ./artemis stop
 
@@ -64,7 +64,7 @@ sleep 5
 sleep 5
 
 ./artemis producer
-./artemis consumer
+./artemis consumer --receive-timeout 10000 --break-on-null
 
 ./artemis-service stop
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-features/src/main/resources/artemis.xml
----------------------------------------------------------------------
diff --git a/artemis-features/src/main/resources/artemis.xml 
b/artemis-features/src/main/resources/artemis.xml
index fc1cdcc..7a51dc2 100644
--- a/artemis-features/src/main/resources/artemis.xml
+++ b/artemis-features/src/main/resources/artemis.xml
@@ -80,6 +80,8 @@ under the License.
             <permission type="deleteNonDurableQueue" roles="manager"/>
             <permission type="createDurableQueue" roles="manager"/>
             <permission type="deleteDurableQueue" roles="manager"/>
+            <permission type="createAddress" roles="manager"/>
+            <permission type="deleteAddress" roles="manager"/>
             <permission type="consume" roles="manager"/>
             <permission type="send" roles="manager"/>
             <!-- we need this otherwise ./artemis data imp wouldn't work -->
@@ -97,7 +99,7 @@ under the License.
             <max-size-bytes>-1</max-size-bytes>
             
<message-counter-history-day-limit>10</message-counter-history-day-limit>
             <address-full-policy>PAGE</address-full-policy>
-            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-queues>true</auto-create-queues>
          </address-setting>
       </address-settings>
    </core>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
----------------------------------------------------------------------
diff --git 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
index 5cbd40f..3d3fa66 100644
--- 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
+++ 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
@@ -410,7 +410,7 @@ public class ActiveMQMessageProducer implements 
MessageProducer, QueueSender, To
                         // TODO is it right to use the address for the queue 
name here?
                         clientSession.createTemporaryQueue(address, address);
                      } else {
-                        clientSession.createQueue(address, address, null, 
true);
+                        clientSession.createQueue(address, address, null, 
true, true);
                      }
                   } else if (!destination.isQueue() && 
query.isAutoCreateJmsTopics()) {
                      clientSession.createAddress(address, true, true);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
----------------------------------------------------------------------
diff --git 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
index f514dba..7fc0fb2 100644
--- 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
+++ 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
@@ -301,10 +301,9 @@ public class ActiveMQSession implements QueueSession, 
TopicSession {
 
             if (!response.isExists()) {
                if (jbd.isQueue() && response.isAutoCreateJmsQueues()) {
-                  // TODO create queue here in such a way that it is deleted 
when consumerCount == 0
                   // perhaps just relying on the broker to do it is simplest 
(i.e. deleteOnNoConsumers)
                   session.createAddress(jbd.getSimpleAddress(), false, true);
-                  session.createQueue(jbd.getSimpleAddress(), 
jbd.getSimpleAddress(), null, true);
+                  session.createQueue(jbd.getSimpleAddress(), 
jbd.getSimpleAddress(), null, true, true);
                } else if (!jbd.isQueue() && response.isAutoCreateJmsTopics()) {
                   session.createAddress(jbd.getSimpleAddress(), true, true);
                } else {
@@ -647,9 +646,7 @@ public class ActiveMQSession implements QueueSession, 
TopicSession {
              */
             if (!response.isExists() || 
!response.getQueueNames().contains(dest.getSimpleAddress())) {
                if (response.isAutoCreateJmsQueues()) {
-                  // TODO create queue here in such a way that it is deleted 
when consumerCount == 0
-                  // perhaps just relying on the broker to do it is simplest 
(i.e. deleteOnNoConsumers)
-                  session.createQueue(dest.getSimpleAddress(), 
dest.getSimpleAddress(), true);
+                  session.createQueue(dest.getSimpleAddress(), 
dest.getSimpleAddress(), null, true, true);
                } else {
                   throw new InvalidDestinationException("Destination " + 
dest.getName() + " does not exist");
                }
@@ -797,7 +794,7 @@ public class ActiveMQSession implements QueueSession, 
TopicSession {
          AddressQuery response = session.addressQuery(new 
SimpleString(activeMQDestination.getAddress()));
          if (!response.isExists()) {
             if (response.isAutoCreateJmsQueues()) {
-               session.createQueue(activeMQDestination.getSimpleAddress(), 
activeMQDestination.getSimpleAddress(), true);
+               session.createQueue(activeMQDestination.getSimpleAddress(), 
activeMQDestination.getSimpleAddress(), null, true, true);
             } else {
                throw new InvalidDestinationException("Destination " + 
activeMQDestination.getName() + " does not exist");
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
 
b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
index 25ad349..74fde63 100644
--- 
a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
+++ 
b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
@@ -1637,9 +1637,9 @@ public class JMSServerManagerImpl implements 
JMSServerManager, ActivateCallback
 //         long consumerCount = queue.getConsumerCount();
 //         long messageCount = queue.getMessageCount();
 //
-//         if 
(address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && 
settings.getAutoDeleteJmsQueues() && queue.getMessageCount() == 0) {
+//         if 
(address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && 
settings.isAutoDeleteJmsQueues() && queue.getMessageCount() == 0) {
 //            if (ActiveMQJMSServerLogger.LOGGER.isDebugEnabled()) {
-//               ActiveMQJMSServerLogger.LOGGER.debug("deleting auto-created 
queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; 
messageCount = " + messageCount + "; getAutoDeleteJmsQueues = " + 
settings.getAutoDeleteJmsQueues());
+//               ActiveMQJMSServerLogger.LOGGER.debug("deleting auto-created 
queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; 
messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + 
settings.isAutoDeleteJmsQueues());
 //            }
 //
 //            return 
destroyQueue(queueName.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()),
 false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index e823d0e..1acf48a 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -722,7 +722,6 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
                server.getSecurityStore().check(qName, checkType, this);
                server.checkQueueCreationLimit(getUsername());
                server.createQueue(qName, qName, null, connInfo == null ? null 
: SimpleString.toSimpleString(connInfo.getUserName()), true, false);
-
             }
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index 35fd733..b2a2068 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -168,7 +168,7 @@ public class AMQSession implements SessionCallback {
          BindingQueryResult bindingQuery = server.bindingQuery(queueName);
          QueueQueryResult queueBinding = server.queueQuery(queueName);
 
-         boolean isAutoCreate = bindingQuery.isExists() ? 
bindingQuery.isAutoCreateJmsQueues() : true;
+         boolean isAutoCreate = bindingQuery.isExists() ?  true : 
bindingQuery.isAutoCreateJmsQueues();
 
          if (!queueBinding.isExists()) {
             if (isAutoCreate) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index 4cb8fe9..3b0991d 100644
--- 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -39,8 +39,10 @@ import 
org.apache.activemq.artemis.core.remoting.FailureListener;
 import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.ServerMessage;
+import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
@@ -251,6 +253,7 @@ public final class StompConnection implements 
RemotingConnection {
       return res;
    }
 
+   // TODO this should take a type - send or receive so it knows whether to 
check the address or the queue
    public void checkDestination(String destination) throws 
ActiveMQStompException {
       if (!manager.destinationExists(destination)) {
          throw 
BUNDLE.destinationNotExist(destination).setHandler(frameHandler);
@@ -259,17 +262,24 @@ public final class StompConnection implements 
RemotingConnection {
 
    public boolean autoCreateDestinationIfPossible(String queue, 
AddressInfo.RoutingType routingType) throws ActiveMQStompException {
       boolean result = false;
+      ServerSession session = getSession().getSession();
 
       try {
          if 
(manager.getServer().getAddressInfo(SimpleString.toSimpleString(queue)) == 
null) {
-            // TODO check here to see if auto-creation is enabled
-            if (routingType.equals(AddressInfo.RoutingType.MULTICAST)) {
-               manager.getServer().createOrUpdateAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(queue)).setAutoCreated(true));
+            AddressSettings addressSettings = 
manager.getServer().getAddressSettingsRepository().getMatch(queue);
+            if (routingType != null && 
routingType.equals(AddressInfo.RoutingType.MULTICAST) && 
addressSettings.isAutoCreateAddresses()) {
+               session.createAddress(SimpleString.toSimpleString(queue), true, 
true);
+               result = true;
             } else {
-               manager.getServer().createOrUpdateAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(queue)).setRoutingType(AddressInfo.RoutingType.ANYCAST).setAutoCreated(true));
-               
manager.getServer().createQueue(SimpleString.toSimpleString(queue), 
SimpleString.toSimpleString(queue), null, null, true, false, true);
+               if (addressSettings.isAutoCreateAddresses()) {
+                  session.createAddress(SimpleString.toSimpleString(queue), 
false, true);
+                  result = true;
+               }
+               if (addressSettings.isAutoCreateQueues()) {
+                  session.createQueue(SimpleString.toSimpleString(queue), 
SimpleString.toSimpleString(queue), null, false, true, null, null, true);
+                  result = true;
+               }
             }
-            result = true;
          }
       } catch (ActiveMQQueueExistsException e) {
          // ignore
@@ -555,6 +565,10 @@ public final class StompConnection implements 
RemotingConnection {
       return manager.createServerMessage();
    }
 
+   public StompSession getSession() throws ActiveMQStompException {
+      return getSession(null);
+   }
+
    public StompSession getSession(String txID) throws ActiveMQStompException {
       StompSession session = null;
       try {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0861be14/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 349c1fd..ea42a40 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
@@ -125,6 +125,10 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
 
    private static final String BROWSE_NAME = "browse";
 
+   private static final String CREATEADDRESS_NAME = "createAddress";
+
+   private static final String DELETEADDRESS_NAME = "deleteAddress";
+
    // Address parsing
 
    private static final String DEAD_LETTER_ADDRESS_NODE_NAME = 
"dead-letter-address";
@@ -171,6 +175,14 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
 
    private static final String AUTO_DELETE_JMS_TOPICS = 
"auto-delete-jms-topics";
 
+   private static final String AUTO_CREATE_QUEUES = "auto-create-queues";
+
+   private static final String AUTO_DELETE_QUEUES = "auto-delete-queues";
+
+   private static final String AUTO_CREATE_ADDRESSES = "auto-create-addresses";
+
+   private static final String AUTO_DELETE_ADDRESSES = "auto-delete-addresses";
+
    private static final String MANAGEMENT_BROWSE_PAGE_SIZE = 
"management-browse-page-size";
 
    private static final String MAX_CONNECTIONS_NODE_NAME = "max-connections";
@@ -696,6 +708,8 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
       ArrayList<String> deleteNonDurableQueue = new ArrayList<>();
       ArrayList<String> manageRoles = new ArrayList<>();
       ArrayList<String> browseRoles = new ArrayList<>();
+      ArrayList<String> createAddressRoles = new ArrayList<>();
+      ArrayList<String> deleteAddressRoles = new ArrayList<>();
       ArrayList<String> allRoles = new ArrayList<>();
       NodeList children = node.getChildNodes();
       for (int i = 0; i < children.getLength(); i++) {
@@ -726,6 +740,10 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
                   manageRoles.add(role.trim());
                } else if (BROWSE_NAME.equals(type)) {
                   browseRoles.add(role.trim());
+               } else if (CREATEADDRESS_NAME.equals(type)) {
+                  createAddressRoles.add(role.trim());
+               } else if (DELETEADDRESS_NAME.equals(type)) {
+                  deleteAddressRoles.add(role.trim());
                } else {
                   
ActiveMQServerLogger.LOGGER.rolePermissionConfigurationError(type);
                }
@@ -842,6 +860,14 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
             
addressSettings.setAutoCreateJmsTopics(XMLUtil.parseBoolean(child));
          } else if (AUTO_DELETE_JMS_TOPICS.equalsIgnoreCase(name)) {
             
addressSettings.setAutoDeleteJmsTopics(XMLUtil.parseBoolean(child));
+         } else if (AUTO_CREATE_QUEUES.equalsIgnoreCase(name)) {
+            addressSettings.setAutoCreateQueues(XMLUtil.parseBoolean(child));
+         } else if (AUTO_DELETE_QUEUES.equalsIgnoreCase(name)) {
+            addressSettings.setAutoDeleteQueues(XMLUtil.parseBoolean(child));
+         } else if (AUTO_CREATE_ADDRESSES.equalsIgnoreCase(name)) {
+            
addressSettings.setAutoCreateAddresses(XMLUtil.parseBoolean(child));
+         } else if (AUTO_DELETE_ADDRESSES.equalsIgnoreCase(name)) {
+            
addressSettings.setAutoDeleteAddresses(XMLUtil.parseBoolean(child));
          } else if (MANAGEMENT_BROWSE_PAGE_SIZE.equalsIgnoreCase(name)) {
             
addressSettings.setManagementBrowsePageSize(XMLUtil.parseInt(child));
          }

Reply via email to