Description
We've been doing a lot of tuning of memory usage limits and exploring the behaviour of producer flow control when these limits are reached. In so doing, we've wanted to validate that memory usage counts are not leaking (e.g., as a result of bugs like AMQ-4116).
In particular, we want to verify that after a large flood of messages is processed and queues become empty, the memory usage on each queue resets to 0.
The existing MBean for queues/topics shows "MemoryPercentUsage" but not the actual bytes that the queue thinks it is using. For large limits, the MemoryPercentUsage can report 0% while there is actually some memory usage remaining. In this case, it is difficult to detect leaks without running many test iterations until the MemoryPercentUsage increments.
Knowing the actual byte count of memory usage is also a more direct way of determining appropriate limits, since these limits themselves are expressed in bytes.
Attached is a simple patch that adds a "MemoryUsage" attribute to the destination MBean.