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 2019/06/25 19:04:08 UTC

[activemq-artemis] branch master updated: ARTEMIS-2387 add scheduled-count and routing-type to queue stat CLI

This is an automated email from the ASF dual-hosted git repository.

jbertram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new a98d995  ARTEMIS-2387 add scheduled-count and routing-type to queue stat CLI
     new 76f8192  This closes #2711
a98d995 is described below

commit a98d995783f20baf6c4d5cbdcf62260931b3abe6
Author: Shailendra Kumar Singh <sh...@gmail.com>
AuthorDate: Tue Jun 18 15:33:15 2019 +0530

    ARTEMIS-2387 add scheduled-count and routing-type to queue stat CLI
---
 .../org/apache/activemq/artemis/cli/commands/queue/StatQueue.java | 8 ++++----
 .../src/test/java/org/apache/activemq/cli/test/ArtemisTest.java   | 2 ++
 .../activemq/artemis/core/management/impl/view/QueueView.java     | 5 ++++-
 .../core/management/impl/view/predicate/QueueFilterPredicate.java | 4 +++-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
index 7175579..9f3e856 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
@@ -36,7 +36,7 @@ public class StatQueue extends AbstractAction {
 
    public enum FIELD {
 
-      NAME("name"), ADDRESS("address"), CONSUMER_COUNT("consumerCount"), MESSAGE_COUNT("messageCount"), MESSAGES_ADDED("messagesAdded"), DELIVERING_COUNT("deliveringCount"), MESSAGES_ACKED("messagesAcked");
+      NAME("name"), ADDRESS("address"), CONSUMER_COUNT("consumerCount"), MESSAGE_COUNT("messageCount"), MESSAGES_ADDED("messagesAdded"), DELIVERING_COUNT("deliveringCount"), MESSAGES_ACKED("messagesAcked"), SCHEDULED_COUNT("scheduledCount"), ROUTING_TYPE("routingType");
 
       private String jsonId;
 
@@ -57,7 +57,7 @@ public class StatQueue extends AbstractAction {
    @Option(name = "--queueName", description = "display queue stats for queue(s) with names containing this string.")
    private String queueName;
 
-   @Option(name = "--field", description = "field to use in filter. Possible values NAME, ADDRESS, MESSAGE_COUNT, MESSAGES_ADDED, DELIVERING_COUNT, MESSAGES_ACKED.")
+   @Option(name = "--field", description = "field to use in filter. Possible values NAME, ADDRESS, MESSAGE_COUNT, MESSAGES_ADDED, DELIVERING_COUNT, MESSAGES_ACKED, SCHEDULED_COUNT, ROUTING_TYPE.")
    private String fieldName;
 
    @Option(name = "--operation", description = "operation to use in filter. Possible values CONTAINS, EQUALS, GREATER_THAN, LESS_THAN.")
@@ -162,7 +162,7 @@ public class StatQueue extends AbstractAction {
 
    private void printHeadings() {
 
-      StringBuilder stringBuilder = new StringBuilder(134).append('|').append(paddingString(new StringBuilder(FIELD.NAME.toString()), 25)).append('|').append(paddingString(new StringBuilder(FIELD.ADDRESS.toString()), 25)).append('|').append(paddingString(new StringBuilder(FIELD.CONSUMER_COUNT.toString() + " "), 15)).append('|').append(paddingString(new StringBuilder(FIELD.MESSAGE_COUNT.toString() + " "), 14)).append('|').append(paddingString(new StringBuilder(FIELD.MESSAGES_ADDED.toStrin [...]
+      StringBuilder stringBuilder = new StringBuilder(134).append('|').append(paddingString(new StringBuilder(FIELD.NAME.toString()), 25)).append('|').append(paddingString(new StringBuilder(FIELD.ADDRESS.toString()), 25)).append('|').append(paddingString(new StringBuilder(FIELD.CONSUMER_COUNT.toString() + " "), 15)).append('|').append(paddingString(new StringBuilder(FIELD.MESSAGE_COUNT.toString() + " "), 14)).append('|').append(paddingString(new StringBuilder(FIELD.MESSAGES_ADDED.toStrin [...]
 
       context.out.println(stringBuilder);
    }
@@ -177,7 +177,7 @@ public class StatQueue extends AbstractAction {
          return;
       }
 
-      StringBuilder stringBuilder = new StringBuilder(134).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.NAME.getJsonId())), 25)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.ADDRESS.getJsonId())), 25)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.CONSUMER_COUNT.getJsonId())), 15)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.MESSAGE_COUNT.getJsonId())), 14)) [...]
+      StringBuilder stringBuilder = new StringBuilder(134).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.NAME.getJsonId())), 25)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.ADDRESS.getJsonId())), 25)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.CONSUMER_COUNT.getJsonId())), 15)).append('|').append(paddingString(new StringBuilder(jsonObject.getString(FIELD.MESSAGE_COUNT.getJsonId())), 14)) [...]
 
       context.out.println(stringBuilder);
    }
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 acfdb9d..ae2da9a 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
@@ -966,6 +966,8 @@ public class ArtemisTest extends CliTestBase {
          Assert.assertEquals("Added count", "15", parts[5].trim());
          Assert.assertEquals("Delivering count", "10", parts[6].trim());
          Assert.assertEquals("Acked count", "5", parts[7].trim());
+         Assert.assertEquals("Scheduled count", "0", parts[8].trim());
+         Assert.assertEquals("Routing type", "ANYCAST", parts[9].trim());
 
          //check all queues containing address "Test1" are displayed using Filter field ADDRESS
          context = new TestActionContext();
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
index 181b6ce..8775715 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
@@ -62,7 +62,8 @@ public class QueueView extends ActiveMQAbstractView<QueueControl> {
          .add("messagesKilled", toString(queue.getMessagesKilled()))
          .add("deliverDeliver", toString(q.isDirectDeliver()))
          .add("exclusive", toString(queue.isExclusive()))
-         .add("lastValue", toString(queue.isLastValue()));
+         .add("lastValue", toString(queue.isLastValue()))
+         .add("scheduledCount", toString(queue.getScheduledCount()));
       return obj;
    }
 
@@ -114,6 +115,8 @@ public class QueueView extends ActiveMQAbstractView<QueueControl> {
             return q.isExclusive();
          case "lastValue":
             return q.isLastValue();
+         case "scheduledCount":
+            return q.getScheduledCount();
          default:
             throw new IllegalArgumentException("Unsupported field, " + fieldName);
       }
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java
index 1183ba5..101660b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java
@@ -27,7 +27,7 @@ public class QueueFilterPredicate extends ActiveMQFilterPredicate<QueueControl>
    enum Field {
       ID, NAME, CONSUMER_ID, QUEUE, ADDRESS, MAX_CONSUMERS, FILTER, MESSAGE_COUNT, CONSUMER_COUNT, DELIVERING_COUNT,
       MESSAGES_ADDED, MESSAGES_ACKED, RATE, ROUTING_TYPE, USER, AUTO_CREATED, DURABLE, PAUSED, TEMPORARY,
-      PURGE_ON_NO_CONSUMERS, MESSAGES_KILLED, DIRECT_DELIVER, LAST_VALUE, EXCLUSIVE
+      PURGE_ON_NO_CONSUMERS, MESSAGES_KILLED, DIRECT_DELIVER, LAST_VALUE, EXCLUSIVE, SCHEDULED_COUNT
    }
 
    private Field f;
@@ -93,6 +93,8 @@ public class QueueFilterPredicate extends ActiveMQFilterPredicate<QueueControl>
                return matches(queue.isExclusive());
             case LAST_VALUE:
                return matches(queue.isLastValue());
+            case SCHEDULED_COUNT:
+               return matches(queue.getScheduledCount());
             default:
                return true;
          }