You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2016/11/23 17:43:17 UTC
[16/48] activemq-artemis git commit: CLI WORK
CLI WORK
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/bd4b7cec
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/bd4b7cec
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/bd4b7cec
Branch: refs/heads/ARTEMIS-780
Commit: bd4b7cecc09701096e5eb8b02b737a9a4990d11e
Parents: d4988a0
Author: Martyn Taylor <mt...@redhat.com>
Authored: Fri Nov 11 14:08:49 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Nov 16 15:24:45 2016 +0000
----------------------------------------------------------------------
.../apache/activemq/artemis/cli/Artemis.java | 15 +-
.../cli/commands/address/AddressAction.java | 77 +++++++
.../cli/commands/address/CreateAddress.java | 72 ++++++
.../cli/commands/address/DeleteAddress.java | 61 +++++
.../cli/commands/address/HelpAddress.java | 56 +++++
.../commands/destination/CreateDestination.java | 147 ------------
.../commands/destination/DeleteDestination.java | 121 ----------
.../commands/destination/DestinationAction.java | 128 -----------
.../commands/destination/HelpDestination.java | 56 -----
.../artemis/cli/commands/queue/CreateQueue.java | 101 +++++++++
.../artemis/cli/commands/queue/DeleteQueue.java | 69 ++++++
.../artemis/cli/commands/queue/HelpQueue.java | 56 +++++
.../artemis/cli/commands/queue/QueueAction.java | 77 +++++++
.../apache/activemq/cli/test/ArtemisTest.java | 5 +-
.../artemis/api/core/ActiveMQException.java | 1 -
.../core/management/ActiveMQServerControl.java | 19 ++
.../impl/ActiveMQServerControlImpl.java | 25 ++
.../core/server/ActiveMQMessageBundle.java | 3 +
.../artemis/core/server/ActiveMQServer.java | 15 +-
.../core/server/ActiveMQServerLogger.java | 2 +-
.../activemq/artemis/core/server/Queue.java | 2 +
.../core/server/impl/ActiveMQServerImpl.java | 39 ++--
.../artemis/core/server/impl/QueueImpl.java | 13 +-
.../core/server/impl/ServerSessionImpl.java | 2 +-
.../management/impl/ManagementServiceImpl.java | 1 -
.../integration/addressing/AddressingTest.java | 10 +-
.../integration/cli/DestinationCommandTest.java | 226 ------------------
.../integration/cli/DummyServerConsumer.java | 204 +++++++++++++++++
.../tests/integration/cli/QueueCommandTest.java | 227 +++++++++++++++++++
.../ActiveMQServerControlUsingCoreTest.java | 11 +
.../integration/mqtt/imported/MQTTTest.java | 4 +-
31 files changed, 1126 insertions(+), 719 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
index 17c4457..94779fc 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
@@ -30,9 +30,11 @@ import org.apache.activemq.artemis.cli.commands.Kill;
import org.apache.activemq.artemis.cli.commands.Mask;
import org.apache.activemq.artemis.cli.commands.Run;
import org.apache.activemq.artemis.cli.commands.Stop;
-import org.apache.activemq.artemis.cli.commands.destination.CreateDestination;
-import org.apache.activemq.artemis.cli.commands.destination.DeleteDestination;
-import org.apache.activemq.artemis.cli.commands.destination.HelpDestination;
+import org.apache.activemq.artemis.cli.commands.address.CreateAddress;
+import org.apache.activemq.artemis.cli.commands.address.DeleteAddress;
+import org.apache.activemq.artemis.cli.commands.queue.CreateQueue;
+import org.apache.activemq.artemis.cli.commands.queue.DeleteQueue;
+import org.apache.activemq.artemis.cli.commands.queue.HelpQueue;
import org.apache.activemq.artemis.cli.commands.messages.Browse;
import org.apache.activemq.artemis.cli.commands.messages.Consumer;
import org.apache.activemq.artemis.cli.commands.messages.Producer;
@@ -128,8 +130,11 @@ public class Artemis {
String instance = artemisInstance != null ? artemisInstance.getAbsolutePath() : System.getProperty("artemis.instance");
Cli.CliBuilder<Action> builder = Cli.<Action>builder("artemis").withDescription("ActiveMQ Artemis Command Line").withCommand(HelpAction.class).withCommand(Producer.class).withCommand(Consumer.class).withCommand(Browse.class).withCommand(Mask.class).withDefaultCommand(HelpAction.class);
- builder.withGroup("destination").withDescription("Destination tools group (create|delete) (example ./artemis destination create)").
- withDefaultCommand(HelpDestination.class).withCommands(CreateDestination.class, DeleteDestination.class);
+ builder.withGroup("queue").withDescription("Queue tools group (create|delete) (example ./artemis queue create)").
+ withDefaultCommand(HelpQueue.class).withCommands(CreateQueue.class, DeleteQueue.class);
+
+ builder.withGroup("address").withDescription("Queue tools group (create|delete) (example ./artemis queue create)").
+ withDefaultCommand(HelpQueue.class).withCommands(CreateAddress.class, DeleteAddress.class);
if (instance != null) {
builder.withGroup("data").withDescription("data tools group (print|exp|imp|exp|encode|decode|compact) (example ./artemis data print)").
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAction.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAction.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAction.java
new file mode 100644
index 0000000..c2f1716
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAction.java
@@ -0,0 +1,77 @@
+/*
+ * 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.cli.commands.address;
+
+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;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.api.core.management.ManagementHelper;
+import org.apache.activemq.artemis.cli.commands.messages.ConnectionAbstract;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+
+public abstract class AddressAction extends ConnectionAbstract {
+
+ @Option(name = "--name", description = "address name")
+ String name;
+
+ public void performCoreManagement(ManagementCallback<ClientMessage> cb) throws Exception {
+
+ try (ActiveMQConnectionFactory factory = createConnectionFactory();
+ ServerLocator locator = factory.getServerLocator();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSession session = sessionFactory.createSession(user, password, false, true, true, false, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE)) {
+ session.start();
+ ClientRequestor requestor = new ClientRequestor(session, "activemq.management");
+ ClientMessage message = session.createMessage(false);
+
+ cb.setUpInvocation(message);
+
+ ClientMessage reply = requestor.request(message);
+
+ if (ManagementHelper.hasOperationSucceeded(reply)) {
+ cb.requestSuccessful(reply);
+ } else {
+ cb.requestFailed(reply);
+ }
+ }
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ if (name == null) {
+ name = input("--name", "Please provide the destination name:", "");
+ }
+
+ return name;
+ }
+
+ public interface ManagementCallback<T> {
+
+ void setUpInvocation(T message) throws Exception;
+
+ void requestSuccessful(T reply) throws Exception;
+
+ void requestFailed(T reply) throws Exception;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/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
new file mode 100644
index 0000000..0474050
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
@@ -0,0 +1,72 @@
+/*
+ * 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.cli.commands.address;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+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.ActionContext;
+
+@Command(name = "create", description = "create a queue or topic")
+public class CreateAddress extends AddressAction {
+
+ @Option(name = "--address", description = "address of the core queue (default queue's name)")
+ String address;
+
+ @Option(name = "--durable", description = "whether the queue is durable or not (default false)")
+ boolean durable = false;
+
+ @Option(name = "--autoCreateAddress", description = "auto create an address for this queue if one doesn't exist")
+ boolean autoCreateAddress = true;
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ super.execute(context);
+ createQueue(context);
+ return null;
+ }
+
+ public String getAddress() {
+ if (address == null || "".equals(address.trim())) {
+ address = getName();
+ }
+ return address.trim();
+ }
+
+ private void createQueue(final ActionContext context) throws Exception {
+ performCoreManagement(new ManagementCallback<ClientMessage>() {
+ @Override
+ public void setUpInvocation(ClientMessage message) throws Exception {
+ String address = getAddress();
+ ManagementHelper.putOperationInvocation(message, "broker", "createQueue", address, getName(), durable);
+ }
+
+ @Override
+ public void requestSuccessful(ClientMessage reply) throws Exception {
+ context.out.println("Core queue " + getName() + " created successfully.");
+ }
+
+ @Override
+ public void requestFailed(ClientMessage reply) throws Exception {
+ String errMsg = (String) ManagementHelper.getResult(reply, String.class);
+ context.err.println("Failed to create queue " + getName() + ". Reason: " + errMsg);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
new file mode 100644
index 0000000..d6ce7f6
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
@@ -0,0 +1,61 @@
+/*
+ * 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.cli.commands.address;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+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.ActionContext;
+
+@Command(name = "delete", description = "delete a queue")
+public class DeleteAddress extends AddressAction {
+
+ @Option(name = "--removeConsumers", description = "whether deleting destination with consumers or not (default false)")
+ boolean removeConsumers = false;
+
+ @Option(name = "--autoDeleteAddress", description = "delete the address if this it's last last queue")
+ boolean autoDeleteAddress = false;
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ super.execute(context);
+ deleteQueue(context);
+ return null;
+ }
+
+ private void deleteQueue(final ActionContext context) throws Exception {
+ performCoreManagement(new ManagementCallback<ClientMessage>() {
+ @Override
+ public void setUpInvocation(ClientMessage message) throws Exception {
+ ManagementHelper.putOperationInvocation(message, "broker", "destroyQueue", getName(), removeConsumers);
+ }
+
+ @Override
+ public void requestSuccessful(ClientMessage reply) throws Exception {
+ context.out.println("Queue " + getName() + " deleted successfully.");
+ }
+
+ @Override
+ public void requestFailed(ClientMessage reply) throws Exception {
+ String errMsg = (String) ManagementHelper.getResult(reply, String.class);
+ context.err.println("Failed to delete queue " + getName() + ". Reason: " + errMsg);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/HelpAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/HelpAddress.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/HelpAddress.java
new file mode 100644
index 0000000..c086c01
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/HelpAddress.java
@@ -0,0 +1,56 @@
+/*
+ * 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.cli.commands.address;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import io.airlift.airline.Help;
+import org.apache.activemq.artemis.cli.commands.Action;
+import org.apache.activemq.artemis.cli.commands.ActionContext;
+
+public class HelpAddress extends Help implements Action {
+
+ @Override
+ public boolean isVerbose() {
+ return false;
+ }
+
+ @Override
+ public void setHomeValues(File brokerHome, File brokerInstance) {
+ }
+
+ @Override
+ public String getBrokerInstance() {
+ return null;
+ }
+
+ @Override
+ public String getBrokerHome() {
+ return null;
+ }
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ List<String> commands = new ArrayList<>(1);
+ commands.add("queue");
+ help(global, commands);
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/CreateDestination.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/CreateDestination.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/CreateDestination.java
deleted file mode 100644
index 4cbaaa6..0000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/CreateDestination.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.cli.commands.destination;
-
-import javax.jms.Message;
-
-import io.airlift.airline.Command;
-import io.airlift.airline.Option;
-import org.apache.activemq.artemis.api.core.client.ClientMessage;
-import org.apache.activemq.artemis.api.core.management.ManagementHelper;
-import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper;
-import org.apache.activemq.artemis.cli.commands.ActionContext;
-
-@Command(name = "create", description = "create a queue or topic")
-public class CreateDestination extends DestinationAction {
-
- @Option(name = "--filter", description = "queue's filter string (default null)")
- String filter = null;
-
- @Option(name = "--address", description = "address of the core queue (default queue's name)")
- String address;
-
- @Option(name = "--durable", description = "whether the queue is durable or not (default false)")
- boolean durable = false;
-
- @Option(name = "--bindings", description = "comma separated jndi binding names (default null)")
- String bindings = null;
-
- @Override
- public Object execute(ActionContext context) throws Exception {
- super.execute(context);
-
- if (JMS_QUEUE.equals(destType)) {
- createJmsQueue(context);
- } else if (CORE_QUEUE.equals(destType)) {
- createCoreQueue(context);
- } else if (JMS_TOPIC.equals(destType)) {
- createJmsTopic(context);
- } else {
- throw new IllegalArgumentException("--type can only be one of " + JMS_QUEUE + ", " + JMS_TOPIC + " and " + CORE_QUEUE);
- }
- return null;
- }
-
- private void createJmsTopic(final ActionContext context) throws Exception {
- performJmsManagement(new ManagementCallback<Message>() {
- @Override
- public void setUpInvocation(Message message) throws Exception {
- JMSManagementHelper.putOperationInvocation(message, "jms.server", "createTopic", getName(), bindings);
- }
-
- @Override
- public void requestSuccessful(Message reply) throws Exception {
- boolean result = (boolean) JMSManagementHelper.getResult(reply, Boolean.class);
- if (result) {
- context.out.println("Topic " + getName() + " created successfully.");
- } else {
- context.err.println("Failed to create topic " + getName() + ".");
- }
- }
-
- @Override
- public void requestFailed(Message reply) throws Exception {
- String errorMsg = (String) JMSManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to create topic " + getName() + ". Reason: " + errorMsg);
- }
- });
- }
-
- public String getAddress() {
- if (address == null || "".equals(address.trim())) {
- address = getName();
- }
- return address.trim();
- }
-
- private void createCoreQueue(final ActionContext context) throws Exception {
- performCoreManagement(new ManagementCallback<ClientMessage>() {
- @Override
- public void setUpInvocation(ClientMessage message) throws Exception {
- String address = getAddress();
- ManagementHelper.putOperationInvocation(message, "core.server", "createQueue", address, getName(), filter, durable);
- }
-
- @Override
- public void requestSuccessful(ClientMessage reply) throws Exception {
- context.out.println("Core queue " + getName() + " created successfully.");
- }
-
- @Override
- public void requestFailed(ClientMessage reply) throws Exception {
- String errMsg = (String) ManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to create queue " + getName() + ". Reason: " + errMsg);
- }
- });
- }
-
- private void createJmsQueue(final ActionContext context) throws Exception {
-
- performJmsManagement(new ManagementCallback<Message>() {
-
- @Override
- public void setUpInvocation(Message message) throws Exception {
- JMSManagementHelper.putOperationInvocation(message, "jms.server", "createQueue", getName(), bindings, filter, durable);
- }
-
- @Override
- public void requestSuccessful(Message reply) throws Exception {
- boolean result = (boolean) JMSManagementHelper.getResult(reply, Boolean.class);
- if (result) {
- context.out.println("Jms queue " + getName() + " created successfully.");
- } else {
- context.err.println("Failed to create jms queue " + getName() + ".");
- }
- }
-
- @Override
- public void requestFailed(Message reply) throws Exception {
- String errorMsg = (String) JMSManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to create jms queue " + getName() + ". Reason: " + errorMsg);
- }
- });
- }
-
- public void setFilter(String filter) {
- this.filter = filter;
- }
-
- public void setBindings(String bindings) {
- this.bindings = bindings;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DeleteDestination.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DeleteDestination.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DeleteDestination.java
deleted file mode 100644
index 93dbf5e..0000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DeleteDestination.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.cli.commands.destination;
-
-import javax.jms.Message;
-
-import io.airlift.airline.Command;
-import io.airlift.airline.Option;
-import org.apache.activemq.artemis.api.core.client.ClientMessage;
-import org.apache.activemq.artemis.api.core.management.ManagementHelper;
-import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper;
-import org.apache.activemq.artemis.cli.commands.ActionContext;
-
-@Command(name = "delete", description = "delete a queue or topic")
-public class DeleteDestination extends DestinationAction {
-
- @Option(name = "--removeConsumers", description = "whether deleting destination with consumers or not (default false)")
- boolean removeConsumers = false;
-
- @Override
- public Object execute(ActionContext context) throws Exception {
- super.execute(context);
-
- if (JMS_QUEUE.equals(destType)) {
- deleteJmsQueue(context);
- } else if (CORE_QUEUE.equals(destType)) {
- deleteCoreQueue(context);
- } else if (JMS_TOPIC.equals(destType)) {
- deleteJmsTopic(context);
- } else {
- throw new IllegalArgumentException("--type can only be one of " + JMS_QUEUE + ", " + JMS_TOPIC + " and " + CORE_QUEUE);
- }
- return null;
- }
-
- private void deleteJmsTopic(final ActionContext context) throws Exception {
- performJmsManagement(new ManagementCallback<Message>() {
- @Override
- public void setUpInvocation(Message message) throws Exception {
- JMSManagementHelper.putOperationInvocation(message, "jms.server", "destroyTopic", getName(), removeConsumers);
- }
-
- @Override
- public void requestSuccessful(Message reply) throws Exception {
- boolean result = (boolean) JMSManagementHelper.getResult(reply, Boolean.class);
- if (result) {
- context.out.println("Topic " + getName() + " deleted successfully.");
- } else {
- context.err.println("Failed to delete topic " + getName());
- }
- }
-
- @Override
- public void requestFailed(Message reply) throws Exception {
- String errorMsg = (String) JMSManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to delete topic " + getName() + ". Reason: " + errorMsg);
- }
- });
- }
-
- private void deleteJmsQueue(final ActionContext context) throws Exception {
- performJmsManagement(new ManagementCallback<Message>() {
- @Override
- public void setUpInvocation(Message message) throws Exception {
- JMSManagementHelper.putOperationInvocation(message, "jms.server", "destroyQueue", getName(), removeConsumers);
- }
-
- @Override
- public void requestSuccessful(Message reply) throws Exception {
- boolean result = (boolean) JMSManagementHelper.getResult(reply, Boolean.class);
- if (result) {
- context.out.println("Jms queue " + getName() + " deleted successfully.");
- } else {
- context.err.println("Failed to delete queue " + getName());
- }
- }
-
- @Override
- public void requestFailed(Message reply) throws Exception {
- String errorMsg = (String) JMSManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to create " + getName() + " with reason: " + errorMsg);
- }
- });
- }
-
- private void deleteCoreQueue(final ActionContext context) throws Exception {
- performCoreManagement(new ManagementCallback<ClientMessage>() {
- @Override
- public void setUpInvocation(ClientMessage message) throws Exception {
- ManagementHelper.putOperationInvocation(message, "core.server", "destroyQueue", getName());
- }
-
- @Override
- public void requestSuccessful(ClientMessage reply) throws Exception {
- context.out.println("Queue " + getName() + " deleted successfully.");
- }
-
- @Override
- public void requestFailed(ClientMessage reply) throws Exception {
- String errMsg = (String) ManagementHelper.getResult(reply, String.class);
- context.err.println("Failed to delete queue " + getName() + ". Reason: " + errMsg);
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DestinationAction.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DestinationAction.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DestinationAction.java
deleted file mode 100644
index 55353d9..0000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/DestinationAction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.cli.commands.destination;
-
-import javax.jms.Message;
-import javax.jms.Queue;
-import javax.jms.QueueRequestor;
-import javax.jms.Session;
-
-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;
-import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.api.core.client.ServerLocator;
-import org.apache.activemq.artemis.api.core.management.ManagementHelper;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper;
-import org.apache.activemq.artemis.cli.commands.messages.ConnectionAbstract;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.client.ActiveMQSession;
-
-public abstract class DestinationAction extends ConnectionAbstract {
-
- public static final String JMS_QUEUE = "jms-queue";
- public static final String JMS_TOPIC = "topic";
- public static final String CORE_QUEUE = "core-queue";
-
- @Option(name = "--type", description = "type of destination to be created (one of jms-queue, topic and core-queue, default jms-queue")
- String destType = JMS_QUEUE;
-
- @Option(name = "--name", description = "destination name")
- String name;
-
- public void performJmsManagement(ManagementCallback<Message> cb) throws Exception {
-
- try (ActiveMQConnectionFactory factory = createConnectionFactory();
- ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
- ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
-
- Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management");
- QueueRequestor requestor = new QueueRequestor(session, managementQueue);
-
- connection.start();
-
- Message message = session.createMessage();
-
- cb.setUpInvocation(message);
-
- Message reply = requestor.request(message);
-
- boolean result = JMSManagementHelper.hasOperationSucceeded(reply);
-
- if (result) {
- cb.requestSuccessful(reply);
- } else {
- cb.requestFailed(reply);
- }
- }
- }
-
- public void performCoreManagement(ManagementCallback<ClientMessage> cb) throws Exception {
-
- try (ActiveMQConnectionFactory factory = createConnectionFactory();
- ServerLocator locator = factory.getServerLocator();
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
- ClientSession session = sessionFactory.createSession(user, password, false, true, true, false, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE)) {
- session.start();
- ClientRequestor requestor = new ClientRequestor(session, "activemq.management");
- ClientMessage message = session.createMessage(false);
-
- cb.setUpInvocation(message);
-
- ClientMessage reply = requestor.request(message);
-
- if (ManagementHelper.hasOperationSucceeded(reply)) {
- cb.requestSuccessful(reply);
- } else {
- cb.requestFailed(reply);
- }
- }
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- if (name == null) {
- name = input("--name", "Please provide the destination name:", "");
- }
-
- return name;
- }
-
- public String getDestType() {
- return destType;
- }
-
- public void setDestType(String destType) {
- this.destType = destType;
- }
-
- public interface ManagementCallback<T> {
-
- void setUpInvocation(T message) throws Exception;
-
- void requestSuccessful(T reply) throws Exception;
-
- void requestFailed(T reply) throws Exception;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/HelpDestination.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/HelpDestination.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/HelpDestination.java
deleted file mode 100644
index 3455520..0000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/destination/HelpDestination.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.cli.commands.destination;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import io.airlift.airline.Help;
-import org.apache.activemq.artemis.cli.commands.Action;
-import org.apache.activemq.artemis.cli.commands.ActionContext;
-
-public class HelpDestination extends Help implements Action {
-
- @Override
- public boolean isVerbose() {
- return false;
- }
-
- @Override
- public void setHomeValues(File brokerHome, File brokerInstance) {
- }
-
- @Override
- public String getBrokerInstance() {
- return null;
- }
-
- @Override
- public String getBrokerHome() {
- return null;
- }
-
- @Override
- public Object execute(ActionContext context) throws Exception {
- List<String> commands = new ArrayList<>(1);
- commands.add("destination");
- help(global, commands);
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
new file mode 100644
index 0000000..fba9369
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
@@ -0,0 +1,101 @@
+/*
+ * 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.cli.commands.queue;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+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.ActionContext;
+
+@Command(name = "create", description = "create a queue or topic")
+public class CreateQueue extends QueueAction {
+
+ @Option(name = "--filter", description = "queue's filter string (default null)")
+ String filter = null;
+
+ @Option(name = "--address", description = "address of the queue (default queue's name)")
+ String address;
+
+ @Option(name = "--durable", description = "whether the queue is durable or not (default false)")
+ boolean durable = false;
+
+ @Option(name = "--deleteOnNoConsumers", description = "whether to delete this queue when it's last consumers disconnects)")
+ boolean deleteOnNoConsumers = false;
+
+ @Option(name = "--maxConsumers", description = "Maximum number of consumers allowed on this queue at any one time (default no limit)")
+ int maxConsumers = -1;
+
+ @Option(name = "--autoCreateAddress", description = "Auto create the address (if it doesn't exist) with default values")
+ boolean autoCreateAddress = false;
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ super.execute(context);
+ createQueue(context);
+ return null;
+ }
+
+ public String getAddress() {
+ if (address == null || "".equals(address.trim())) {
+ address = getName();
+ }
+ return address.trim();
+ }
+
+ private void createQueue(final ActionContext context) throws Exception {
+ performCoreManagement(new ManagementCallback<ClientMessage>() {
+ @Override
+ public void setUpInvocation(ClientMessage message) throws Exception {
+ String address = getAddress();
+ ManagementHelper.putOperationInvocation(message, "broker", "createQueue", address, getName(), filter, durable, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
+ }
+
+ @Override
+ public void requestSuccessful(ClientMessage reply) throws Exception {
+ context.out.println("Core queue " + getName() + " created successfully.");
+ }
+
+ @Override
+ public void requestFailed(ClientMessage reply) throws Exception {
+ String errMsg = (String) ManagementHelper.getResult(reply, String.class);
+ context.err.println("Failed to create queue " + getName() + ". Reason: " + errMsg);
+ }
+ });
+ }
+
+ public void setFilter(String filter) {
+ this.filter = filter;
+ }
+
+ public void setAutoCreateAddress(boolean autoCreateAddress) {
+ this.autoCreateAddress = autoCreateAddress;
+ }
+
+ public void setMaxConsumers(int maxConsumers) {
+ this.maxConsumers = maxConsumers;
+ }
+
+ public void setDeleteOnNoConsumers(boolean deleteOnNoConsumers) {
+ this.deleteOnNoConsumers = deleteOnNoConsumers;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/DeleteQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/DeleteQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/DeleteQueue.java
new file mode 100644
index 0000000..5d92e81
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/DeleteQueue.java
@@ -0,0 +1,69 @@
+/*
+ * 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.cli.commands.queue;
+
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+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.ActionContext;
+
+@Command(name = "delete", description = "delete a queue")
+public class DeleteQueue extends QueueAction {
+
+ @Option(name = "--removeConsumers", description = "whether deleting destination with consumers or not (default false)")
+ boolean removeConsumers = false;
+
+ @Option(name = "--autoDeleteAddress", description = "delete the address if this it's last last queue")
+ boolean autoDeleteAddress = false;
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ super.execute(context);
+ deleteQueue(context);
+ return null;
+ }
+
+ private void deleteQueue(final ActionContext context) throws Exception {
+ performCoreManagement(new ManagementCallback<ClientMessage>() {
+ @Override
+ public void setUpInvocation(ClientMessage message) throws Exception {
+ ManagementHelper.putOperationInvocation(message, "broker", "destroyQueue", getName(), removeConsumers);
+ }
+
+ @Override
+ public void requestSuccessful(ClientMessage reply) throws Exception {
+ context.out.println("Queue " + getName() + " deleted successfully.");
+ }
+
+ @Override
+ public void requestFailed(ClientMessage reply) throws Exception {
+ String errMsg = (String) ManagementHelper.getResult(reply, String.class);
+ context.err.println("Failed to delete queue " + getName() + ". Reason: " + errMsg);
+ }
+ });
+ }
+
+ public void setRemoveConsumers(boolean removeConsumers) {
+ this.removeConsumers = removeConsumers;
+ }
+
+ public void setAutoDeleteAddress(boolean autoDeleteAddress) {
+ this.autoDeleteAddress = autoDeleteAddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/HelpQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/HelpQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/HelpQueue.java
new file mode 100644
index 0000000..687e0f4
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/HelpQueue.java
@@ -0,0 +1,56 @@
+/*
+ * 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.cli.commands.queue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import io.airlift.airline.Help;
+import org.apache.activemq.artemis.cli.commands.Action;
+import org.apache.activemq.artemis.cli.commands.ActionContext;
+
+public class HelpQueue extends Help implements Action {
+
+ @Override
+ public boolean isVerbose() {
+ return false;
+ }
+
+ @Override
+ public void setHomeValues(File brokerHome, File brokerInstance) {
+ }
+
+ @Override
+ public String getBrokerInstance() {
+ return null;
+ }
+
+ @Override
+ public String getBrokerHome() {
+ return null;
+ }
+
+ @Override
+ public Object execute(ActionContext context) throws Exception {
+ List<String> commands = new ArrayList<>(1);
+ commands.add("queue");
+ help(global, commands);
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAction.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAction.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAction.java
new file mode 100644
index 0000000..dc839ef
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAction.java
@@ -0,0 +1,77 @@
+/*
+ * 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.cli.commands.queue;
+
+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;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.api.core.management.ManagementHelper;
+import org.apache.activemq.artemis.cli.commands.messages.ConnectionAbstract;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+
+public abstract class QueueAction extends ConnectionAbstract {
+
+ @Option(name = "--name", description = "queue name")
+ String name;
+
+ public void performCoreManagement(ManagementCallback<ClientMessage> cb) throws Exception {
+
+ try (ActiveMQConnectionFactory factory = createConnectionFactory();
+ ServerLocator locator = factory.getServerLocator();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSession session = sessionFactory.createSession(user, password, false, true, true, false, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE)) {
+ session.start();
+ ClientRequestor requestor = new ClientRequestor(session, "activemq.management");
+ ClientMessage message = session.createMessage(false);
+
+ cb.setUpInvocation(message);
+
+ ClientMessage reply = requestor.request(message);
+
+ if (ManagementHelper.hasOperationSucceeded(reply)) {
+ cb.requestSuccessful(reply);
+ } else {
+ cb.requestFailed(reply);
+ }
+ }
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ if (name == null) {
+ name = input("--name", "Please provide the destination name:", "");
+ }
+
+ return name;
+ }
+
+ public interface ManagementCallback<T> {
+
+ void setUpInvocation(T message) throws Exception;
+
+ void requestSuccessful(T reply) throws Exception;
+
+ void requestFailed(T reply) throws Exception;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/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 cac6229..dd306e9 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
@@ -536,13 +536,16 @@ public class ArtemisTest {
// This is usually set when run from the command line via artemis.profile
- Run.setEmbedded(true);
+ Run.setEmbedded(false);
Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--topics", topics, "--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");
+
try {
try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
ClientSessionFactory factory = locator.createSessionFactory();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
index 6404c74..16e2b41 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQException.java
@@ -76,5 +76,4 @@ public class ActiveMQException extends Exception {
public String toString() {
return this.getClass().getSimpleName() + "[errorType=" + type + " message=" + getMessage() + "]";
}
-
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/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 7772459..4384d54 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
@@ -490,6 +490,25 @@ public interface ActiveMQServerControl {
@Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception;
/**
+ * Create a queue.
+ * <br>
+ * If {@code address} is {@code null} it will be defaulted to {@code name}.
+ * <br>
+ * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exits.
+ *
+ * @param address address to bind the queue to
+ * @param name name of the queue
+ * @param durable whether the queue is durable
+ */
+ @Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION)
+ void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
+ @Parameter(name = "name", desc = "Name of the queue") String name,
+ @Parameter(name = "filter", desc = "Filter of the queue") String filter,
+ @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
+ @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
+ @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
+ @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception;
+ /**
* Deploy a durable queue.
* <br>
* If {@code address} is {@code null} it will be defaulted to {@code name}.
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index a183187..f2a193f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -49,6 +49,7 @@ import org.apache.activemq.artemis.api.core.management.AddressControl;
import org.apache.activemq.artemis.api.core.management.BridgeControl;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.api.core.management.DivertControl;
+import org.apache.activemq.artemis.api.core.management.Parameter;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.core.client.impl.Topology;
import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
@@ -633,6 +634,30 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
}
@Override
+ public void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
+ @Parameter(name = "name", desc = "Name of the queue") String name,
+ @Parameter(name = "filter", desc = "Filter of the queue") String filterStr,
+ @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
+ @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
+ @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
+ @Parameter(name = "autoCreateAddress", desc = "Create an address with default values if one does not exist") boolean autoCreateAddress) throws Exception {
+ checkStarted();
+
+ clearIO();
+
+ SimpleString filter = filterStr == null ? null : new SimpleString(filterStr);
+ try {
+ if (filterStr != null && !filterStr.trim().equals("")) {
+ filter = new SimpleString(filterStr);
+ }
+
+ server.createQueue(SimpleString.toSimpleString(address), new SimpleString(name), filter, durable, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
+ } finally {
+ blockOnIO();
+ }
+ }
+
+ @Override
public void createQueue(final String address,
final String name,
final String filterStr,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
index 6d8cf30..a64e4fc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
@@ -390,4 +390,7 @@ public interface ActiveMQMessageBundle {
@Message(id = 119202, value = "Invalid Queue Configuration for Queue {0}, Address {1}. Expected {2} to be {3} but was {4}", format = Message.Format.MESSAGE_FORMAT)
ActiveMQInvalidQueueConfiguration invalidQueueConfiguration(SimpleString address, SimpleString queueName, String queuePropertyName, Object expectedValue, Object actualValue);
+
+ @Message(id = 119203, value = "Address Does Not Exist: {0}", format = Message.Format.MESSAGE_FORMAT)
+ ActiveMQInvalidQueueConfiguration addressDoesNotExist(SimpleString address);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 5dc22d6..723ddf4 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -281,7 +281,8 @@ public interface ActiveMQServer extends ActiveMQComponent {
boolean durable,
boolean temporary,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception;
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception;
Queue createQueue(SimpleString address,
SimpleString queueName,
@@ -297,7 +298,8 @@ public interface ActiveMQServer extends ActiveMQComponent {
boolean durable,
boolean temporary,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception;
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception;
Queue createQueue(SimpleString address,
SimpleString queueName,
@@ -315,7 +317,8 @@ public interface ActiveMQServer extends ActiveMQComponent {
boolean temporary,
boolean autoCreated,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception;
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception;
Queue deployQueue(SimpleString address,
SimpleString queueName,
@@ -343,7 +346,8 @@ public interface ActiveMQServer extends ActiveMQComponent {
boolean temporary,
boolean autoCreated,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception;
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception;
void destroyQueue(SimpleString queueName) throws Exception;
@@ -406,7 +410,8 @@ public interface ActiveMQServer extends ActiveMQComponent {
boolean transientQueue,
boolean autoCreated,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception;
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception;
/*
* add a ProtocolManagerFactory to be used. Note if @see Configuration#isResolveProtocols is tur then this factory will
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 51aa57b..9907f7f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -785,7 +785,7 @@ public interface ActiveMQServerLogger extends BasicLogger {
format = Message.Format.MESSAGE_FORMAT)
void noQueueIdDefined(ServerMessage message, ServerMessage messageCopy, SimpleString idsHeaderName);
- @LogMessage(level = Logger.Level.WARN)
+ @LogMessage(level = Logger.Level.TRACE)
@Message(id = 222111, value = "exception while invoking {0} on {1}",
format = Message.Format.MESSAGE_FORMAT)
void managementOperationError(@Cause Exception e, String op, String resourceName);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
index 2b845d5..0120a53 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
@@ -106,6 +106,8 @@ public interface Queue extends Bindable {
void deleteQueue(boolean removeConsumers) throws Exception;
+ void deleteQueue(boolean removeConsumers, boolean autoDeleteAddress) throws Exception;
+
void destroyPaging() throws Exception;
long getMessageCount();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index a4c139b..1e1424d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -1406,8 +1406,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final boolean durable,
final boolean temporary,
final Integer maxConsumers,
- final Boolean deleteOnNoConsumers) throws Exception {
- return createQueue(address, queueName, filterString, null, durable, temporary, false, false, false, maxConsumers, deleteOnNoConsumers);
+ final Boolean deleteOnNoConsumers,
+ final boolean autoCreateAddress) throws Exception {
+ return createQueue(address, queueName, filterString, null, durable, temporary, false, false, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
}
@Override
@@ -1428,8 +1429,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
boolean durable,
boolean temporary,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception {
- return createQueue(address, queueName, filter, user, durable, temporary, false, false, false, maxConsumers, deleteOnNoConsumers);
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception {
+ return createQueue(address, queueName, filter, user, durable, temporary, false, false, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
}
@Override
@@ -1452,8 +1454,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
boolean temporary,
boolean autoCreated,
Integer maxConsumers,
- Boolean deleteOnNoConsumers) throws Exception {
- return createQueue(address, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, deleteOnNoConsumers);
+ Boolean deleteOnNoConsumers,
+ boolean autoCreateAddress) throws Exception {
+ return createQueue(address, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
}
@Override
@@ -1515,7 +1518,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final boolean durable,
final boolean temporary,
final boolean autoCreated) throws Exception {
- return deployQueue(address, queueName, filterString, durable, temporary, autoCreated, null, null);
+ return deployQueue(address, queueName, filterString, durable, temporary, autoCreated, null, null, true);
}
@Override
@@ -1526,12 +1529,13 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final boolean temporary,
final boolean autoCreated,
final Integer maxConsumers,
- final Boolean deleteOnNoConsumers) throws Exception {
+ final Boolean deleteOnNoConsumers,
+ final boolean autoCreateAddress) throws Exception {
// TODO: fix logging here as this could be for a topic or queue
ActiveMQServerLogger.LOGGER.deployQueue(queueName);
- return createQueue(address, queueName, filterString, null, durable, temporary, true, false, autoCreated, maxConsumers, deleteOnNoConsumers);
+ return createQueue(address, queueName, filterString, null, durable, temporary, true, false, autoCreated, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
}
@Override
@@ -2131,7 +2135,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
private void deployQueuesFromListCoreQueueConfiguration(List<CoreQueueConfiguration> queues) throws Exception {
for (CoreQueueConfiguration config : queues) {
- deployQueue(SimpleString.toSimpleString(config.getAddress()), SimpleString.toSimpleString(config.getName()), SimpleString.toSimpleString(config.getFilterString()), config.isDurable(), false, false, config.getMaxConsumers(), config.getDeleteOnNoConsumers());
+ deployQueue(SimpleString.toSimpleString(config.getAddress()), SimpleString.toSimpleString(config.getName()), SimpleString.toSimpleString(config.getFilterString()), config.isDurable(), false, false, config.getMaxConsumers(), config.getDeleteOnNoConsumers(), true);
}
}
@@ -2298,7 +2302,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
transientQueue,
autoCreated,
null,
- null);
+ null,
+ true);
}
@Override
@@ -2312,7 +2317,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final boolean transientQueue,
final boolean autoCreated,
final Integer maxConsumers,
- final Boolean deleteOnNoConsumers) throws Exception {
+ final Boolean deleteOnNoConsumers,
+ final boolean autoCreateAddress) throws Exception {
+
final QueueBinding binding = (QueueBinding) postOffice.getBinding(queueName);
if (binding != null) {
if (ignoreIfExists) {
@@ -2335,11 +2342,15 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
AddressInfo defaultAddressInfo = new AddressInfo(addressName);
- // FIXME This boils down to a putIfAbsent (avoids race). This should be reflected in the API.
AddressInfo info = postOffice.getAddressInfo(addressName);
if (info == null) {
- info = defaultAddressInfo;
+ if (autoCreateAddress) {
+ info = defaultAddressInfo;
+ }
+ else {
+ throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressName);
+ }
}
final boolean isDeleteOnNoConsumers = deleteOnNoConsumers == null ? info.isDefaultDeleteOnNoConsumers() : deleteOnNoConsumers;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index 7c614ae..b9cb79f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -1420,8 +1420,14 @@ public class QueueImpl implements Queue {
@Override
public void deleteQueue(boolean removeConsumers) throws Exception {
+ deleteQueue(removeConsumers, false);
+ }
+
+ @Override
+ public void deleteQueue(boolean removeConsumers, boolean autoDeleteAddress) throws Exception {
synchronized (this) {
- if (this.queueDestroyed) return;
+ if (this.queueDestroyed)
+ return;
this.queueDestroyed = true;
}
@@ -1454,7 +1460,6 @@ public class QueueImpl implements Queue {
tx.rollback();
throw e;
}
-
}
@Override
@@ -1799,7 +1804,7 @@ public class QueueImpl implements Queue {
}
@Override
- public synchronized void pause(boolean persist) {
+ public synchronized void pause(boolean persist) {
try {
this.flushDeliveriesInTransit();
if (persist && isDurable()) {
@@ -2960,8 +2965,6 @@ public class QueueImpl implements Queue {
return false;
}
-
-
@Override
public MessageReference next() {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 80fa7b2..aafcced 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -509,7 +509,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
server.checkQueueCreationLimit(getUsername());
- Queue queue = server.createQueue(address, name, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, deleteOnNoConsumers);
+ Queue queue = server.createQueue(address, name, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, maxConsumers, deleteOnNoConsumers, true);
if (temporary) {
// Temporary queue in core simply means the queue will be deleted if
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index 349d36a..61365c7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -739,7 +739,6 @@ public class ManagementServiceImpl implements ManagementService {
}
Object result = method.invoke(resource, params);
-
return result;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd4b7cec/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java
index b6e4de7..827e1b3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java
@@ -229,7 +229,7 @@ public class AddressingTest extends ActiveMQTestBase {
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
// For each address, create 2 Queues with the same address, assert both queues receive message
boolean deleteOnNoConsumers = true;
- Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers);
+ Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, false);
ClientSession session = sessionFactory.createSession();
session.start();
@@ -246,7 +246,7 @@ public class AddressingTest extends ActiveMQTestBase {
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
// For each address, create 2 Queues with the same address, assert both queues receive message
boolean deleteOnNoConsumers = false;
- Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers);
+ Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, false);
ClientSession session = sessionFactory.createSession();
session.start();
@@ -263,7 +263,7 @@ public class AddressingTest extends ActiveMQTestBase {
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
// For each address, create 2 Queues with the same address, assert both queues receive message
boolean deleteOnNoConsumers = false;
- Queue q1 = server.createQueue(address, queueName, null, true, false, 0, deleteOnNoConsumers);
+ Queue q1 = server.createQueue(address, queueName, null, true, false, 0, deleteOnNoConsumers, false);
Exception expectedException = null;
String expectedMessage = "Maximum Consumer Limit Reached on Queue";
@@ -290,7 +290,7 @@ public class AddressingTest extends ActiveMQTestBase {
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
// For each address, create 2 Queues with the same address, assert both queues receive message
boolean deleteOnNoConsumers = false;
- Queue q1 = server.createQueue(address, queueName, null, true, false, -1, deleteOnNoConsumers);
+ Queue q1 = server.createQueue(address, queueName, null, true, false, -1, deleteOnNoConsumers, false);
ClientSession session = sessionFactory.createSession();
session.start();
@@ -310,7 +310,7 @@ public class AddressingTest extends ActiveMQTestBase {
boolean deleteOnNoConsumers = false;
AddressInfo addressInfo = new AddressInfo(address);
addressInfo.setDefaultMaxQueueConsumers(0);
- Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers);
+ Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, false);
ClientSession session = sessionFactory.createSession();
session.start();