use of org.apache.pulsar.broker.service.Dispatcher in project incubator-pulsar by apache.
the class PersistentSubscription method getStats.
public SubscriptionStats getStats() {
SubscriptionStats subStats = new SubscriptionStats();
Dispatcher dispatcher = this.dispatcher;
if (dispatcher != null) {
dispatcher.getConsumers().forEach(consumer -> {
ConsumerStats consumerStats = consumer.getStats();
subStats.consumers.add(consumerStats);
subStats.msgRateOut += consumerStats.msgRateOut;
subStats.msgThroughputOut += consumerStats.msgThroughputOut;
subStats.msgRateRedeliver += consumerStats.msgRateRedeliver;
subStats.unackedMessages += consumerStats.unackedMessages;
});
}
subStats.type = getType();
if (SubType.Shared.equals(subStats.type)) {
if (dispatcher instanceof PersistentDispatcherMultipleConsumers) {
subStats.unackedMessages = ((PersistentDispatcherMultipleConsumers) dispatcher).getTotalUnackedMessages();
subStats.blockedSubscriptionOnUnackedMsgs = ((PersistentDispatcherMultipleConsumers) dispatcher).isBlockedDispatcherOnUnackedMsgs();
}
}
subStats.msgBacklog = getNumberOfEntriesInBacklog();
subStats.msgRateExpired = expiryMonitor.getMessageExpiryRate();
return subStats;
}
Aggregations