Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2237#discussion_r209369424
  
    --- Diff: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
 ---
    @@ -711,6 +712,32 @@ public long countMessages(final String filterStr) 
throws Exception {
           }
        }
     
    +   @Override
    +   public String countMessagesProperty(final String filter) throws 
Exception {
    +      checkStarted();
    +      clearIO();
    +      try {
    +         try (LinkedListIterator<MessageReference> iterator = 
queue.browserIterator()) {
    +            Map<String, Integer> result = new HashMap<>();
    +            String propertySearch = filter == null ? UNDEFINED : filter;
    +            try {
    +               while (iterator.hasNext()) {
    +                  MessageReference ref = iterator.next();
    +                  String messageProperty = 
ref.getMessage().getStringProperty(propertySearch);
    --- End diff --
    
    But it isnt being used as such new objects will be created for no reason. 
All you want to do is check if the property exists
     As i said doing this with a filter to run over to get the counts will be 
more powerful and clea er


---

Reply via email to