Fixing DurableTopicSubscription so that an ack will properly update the
forwards statistic on an ack
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-07-29 15:56:52 -04:00
parent dd971a00f2
commit 82295fd2c6
2 changed files with 9 additions and 0 deletions

View File

@ -328,6 +328,9 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
redeliveredMessages.remove(node.getMessageId());
node.decrementReferenceCount();
((Destination)node.getRegionDestination()).getDestinationStatistics().getDequeues().increment();
if (info.isNetworkSubscription()) {
((Destination)node.getRegionDestination()).getDestinationStatistics().getForwards().add(ack.getMessageCount());
}
}
@Override

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.network;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@ -211,6 +212,11 @@ public class SimpleNetworkTest {
producer.send(test);
}
Thread.sleep(1000);
//Make sure stats are set
assertEquals(MESSAGE_COUNT,
localBroker.getDestination(included).getDestinationStatistics().getForwards().getCount());
// close everything down and restart
doTearDown();
doSetUp(false);