eolivelli commented on code in PR #16545:
URL: https://github.com/apache/pulsar/pull/16545#discussion_r923069240
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -1569,6 +1589,48 @@ private void
internalDeleteSubscriptionForNonPartitionedTopic(AsyncResponse asyn
});
}
+ private void
internalAnalyzeSubscriptionBacklogForNonPartitionedTopic(AsyncResponse
asyncResponse,
+
String subName,
+
boolean authoritative) {
+ validateTopicOwnershipAsync(topicName, authoritative)
+ .thenRun(() -> validateTopicOperation(topicName,
TopicOperation.CONSUME))
+ .thenCompose(__ -> getTopicReferenceAsync(topicName))
+ .thenCompose(topic -> {
+ Subscription sub = topic.getSubscription(subName);
+ if (sub == null) {
+ throw new RestException(Status.NOT_FOUND,
+
getSubNotFoundErrorMessage(topicName.toString(), subName));
+ }
+ return sub.analyzeBacklog();
+ })
+ .thenAccept((AnalyzeBacklogResult rawResult) -> {
+
+ AnalyzeSubscriptionBacklogResult result = new
AnalyzeSubscriptionBacklogResult();
+ result.setEntries(rawResult.getEntries());
+ result.setMessages(rawResult.getMessages());
+
+
result.setFilterAcceptedEntries(rawResult.getFilterAcceptedEntries());
+
result.setFilterRejectedEntries(rawResult.getFilterRejectedEntries());
+
result.setFilterRescheduledEntries(rawResult.getFilterRescheduledEntries());
+
+
result.setFilterAcceptedMessages(rawResult.getFilterAcceptedMessages());
+
result.setFilterRejectedMessages(rawResult.getFilterRejectedMessages());
+
result.setFilterRescheduledMessages(rawResult.getFilterRescheduledMessages());
+ result.setAborted(rawResult.getScanOutcome() !=
ScanOutcome.COMPLETED);
+ log.info("[{}] analyzeBacklog topic {} subscription {}
result {}", clientAppId(), subName,
+ topicName, result);
+ asyncResponse.resume(result);
+ }).exceptionally(ex -> {
+ Throwable cause = ex.getCause();
+ // If the exception is not redirect exception we need to
log it.
+ if (!isRedirectException(ex)) {
+ log.error("[{}] Failed to analyze subscription backlog
{} {}",
+ clientAppId(), topicName, subName, cause);
+ }
+ asyncResponse.resume(new RestException(cause));
Review Comment:
I forgot about that. Thanks
--
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]