[
https://issues.apache.org/jira/browse/ARTEMIS-2022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16576804#comment-16576804
]
ASF GitHub Bot commented on ARTEMIS-2022:
-----------------------------------------
Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2237#discussion_r209375108
--- 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 --
You will better calling to get object as then where there maybe properties
that dont actually get stored in the property map but are actually a top level
field it would still return for all. And then you can simply call
Objects.toString on the returned object, this would also then remove the need
for undefined and would return the java normal string representation for null
> Create count messages "group by" this property filter
> -----------------------------------------------------
>
> Key: ARTEMIS-2022
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2022
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Affects Versions: 2.6.3
> Reporter: Arthur Fritz Santiago
> Priority: Major
> Labels: features
>
> Create a new function countMessagesProperty.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)