BewareMyPower commented on code in PR #21927:
URL: https://github.com/apache/pulsar/pull/21927#discussion_r1519139730


##########
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Topics.java:
##########
@@ -1636,6 +1636,27 @@ void expireMessagesForAllSubscriptions(String topic, 
long expireTimeInSeconds)
      */
     CompletableFuture<Void> expireMessagesForAllSubscriptionsAsync(String 
topic, long expireTimeInSeconds);
 
+    /**
+     * Peek messages from a topic subscription.
+     *
+     * @param topic
+     *            topic name
+     * @param subName
+     *            Subscription name
+     * @param  offset
+     *            Start index to start reading messages.
+     * @param numMessages
+     *            Number of messages
+     * @return
+     * @throws NotAuthorizedException
+     *             Don't have admin permission
+     * @throws NotFoundException
+     *             Topic or subscription does not exist
+     * @throws PulsarAdminException
+     *             Unexpected error
+     */
+    List<Message<byte[]>> peekMessages(String topic, String subName, int 
offset, int numMessages) throws PulsarAdminException;

Review Comment:
   BTW, after introducing these new methods, you can change the original calls 
to default methods and then you won't need to copy the API docs to this new 
method.
   
   ```java
       /**
        * <original API docs...>
        * @param  offset
        *            Start index to start reading messages.
        * <original API docs...>
        */
       List<Message<byte[]>> peekMessages(String topic, String subName, int 
startPosition, int numMessages) throws PulsarAdminException;
   
       default List<Message<byte[]>> peekMessages(String topic, String subName, 
int numMessages) throws PulsarAdminException {
           return peekMessages(topic, subName, 1, numMessages);
       }
   ```



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to