MarvinCai commented on a change in pull request #11119:
URL: https://github.com/apache/pulsar/pull/11119#discussion_r661171413
##########
File path:
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java
##########
@@ -849,6 +850,62 @@ default TopicStats getStats(String topic) throws
PulsarAdminException {
return getStatsAsync(topic, false, false);
}
+
+ /**
+ * Get the stats for non-persistent topic.
+ * All the rates are computed over a 1 minute window and are relative the
last completed 1 minute period.
+ *
+ * @param topic
+ * topic name
+ * @param getPreciseBacklog
+ * Set to true to get precise backlog, Otherwise get imprecise
backlog.
+ * @param subscriptionBacklogSize
+ * Whether to get backlog size for each subscription.
+ * @return the topic statistics
+ *
+ * @throws NotAuthorizedException
+ * Don't have admin permission
+ * @throws NotFoundException
+ * Topic does not exist
+ * @throws PulsarAdminException
+ * Unexpected error
+ */
+ NonPersistentTopicStats getStatsNonPersistent(String topic, boolean
getPreciseBacklog,
Review comment:
@codelipenghui
I just tried that, once the response object got deserialized as TopicStats,
it's actual type will be TopicStatsImpl at client side(we set the binding at
ObjectMapperFactory
[ref](https://github.com/apache/pulsar/blob/3cbfd7454ce824a720d1dc645ea23ee3831ffff0/pulsar-common/src/main/java/org/apache/pulsar/common/util/ObjectMapperFactory.java#L179)),
even server send it out as NonPersistentTopicStatsImpl, and we won't be able
to convert the object back to NonPersistentTopicStats or
NonPersistentTopicStatsImpl.
I think we'll have to deserialize the response to the desired type when we
receive it. So a new method is needed for this purpose.
--
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]