michaelpearce-gain commented on code in PR #4126:
URL: https://github.com/apache/activemq-artemis/pull/4126#discussion_r910325886


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java:
##########
@@ -1770,8 +1770,26 @@ public String listConsumersAsJSON() throws Exception {
 
             if (consumer instanceof ServerConsumer) {
                ServerConsumer serverConsumer = (ServerConsumer) consumer;
-
-               JsonObjectBuilder obj = 
JsonLoader.createObjectBuilder().add("consumerID", 
serverConsumer.getID()).add("connectionID", 
serverConsumer.getConnectionID().toString()).add("sessionID", 
serverConsumer.getSessionID()).add("browseOnly", 
serverConsumer.isBrowseOnly()).add("creationTime", 
serverConsumer.getCreationTime());
+               List<MessageReference> deliveringMessages = 
consumer.getDeliveringMessages();
+               long deliveringMessageSize = 0;
+               for (int i = 0; i < deliveringMessages.size(); i++) {
+                  MessageReference messageReference =  
deliveringMessages.get(i);
+                  deliveringMessageSize += 
messageReference.getMessage().getEncodeSize();

Review Comment:
   If we want this for metrics would be safer to keep this count as a metric on 
the consumer adding the size and removing it from the metric as messages are 
added or ack'd this would also save on the above mentioned npe / concurrent 
issue 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to