Repository: activemq-artemis Updated Branches: refs/heads/master 3c8c434f1 -> a6c48a37c
ARTEMIS-1840 Added Error and Doc to Import Message Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a6c48a37 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a6c48a37 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a6c48a37 Branch: refs/heads/master Commit: a6c48a37c77aca8eb5b01abae0ca48ef0c186575 Parents: 3c8c434 Author: Martyn Taylor <mtay...@redhat.com> Authored: Thu May 3 11:13:56 2018 +0100 Committer: Martyn Taylor <mtay...@redhat.com> Committed: Thu May 3 11:43:50 2018 +0100 ---------------------------------------------------------------------- .../cli/commands/messages/DestAbstract.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6c48a37/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java index 63b5f17..64c6e66 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/DestAbstract.java @@ -23,6 +23,7 @@ import java.nio.ByteBuffer; import io.airlift.airline.Option; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; 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; @@ -43,7 +44,7 @@ public class DestAbstract extends ConnectionAbstract { private static final String FQQN_SEPERATOR = "::"; - @Option(name = "--destination", description = "Destination to be used. It can be prefixed with queue:// or topic:// (Default: queue://TEST)") + @Option(name = "--destination", description = "Destination to be used. It can be prefixed with queue:// or topic:// or fqqn:// (Default: queue://TEST)") String destination = "queue://TEST"; @Option(name = "--message-count", description = "Number of messages to act on (Default: 1000)") @@ -111,11 +112,15 @@ public class DestAbstract extends ConnectionAbstract { } public byte[] getQueueIdFromName(String queueName) throws Exception { - ClientMessage message = getQueueAttribute(queueName, "ID"); - Number idObject = (Number) ManagementHelper.getResult(message); - ByteBuffer byteBuffer = ByteBuffer.allocate(8); - byteBuffer.putLong(idObject.longValue()); - return byteBuffer.array(); + try { + ClientMessage message = getQueueAttribute(queueName, "ID"); + Number idObject = (Number) ManagementHelper.getResult(message); + ByteBuffer byteBuffer = ByteBuffer.allocate(8); + byteBuffer.putLong(idObject.longValue()); + return byteBuffer.array(); + } catch (Exception e) { + throw new ActiveMQException("Error occured when looking up FQQN. Please ensure the FQQN exists.", e, ActiveMQExceptionType.ILLEGAL_STATE); + } } protected ClientMessage getQueueAttribute(String queueName, String attribute) throws Exception {