You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/01/17 14:59:04 UTC

[GitHub] ivankelly commented on a change in pull request #1066: Issue 937: add CommandGetLastMessageId to make reader know the end of topic

ivankelly commented on a change in pull request #1066: Issue 937: add CommandGetLastMessageId to make reader know the end of topic
URL: https://github.com/apache/incubator-pulsar/pull/1066#discussion_r162067685
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
 ##########
 @@ -851,6 +849,31 @@ protected void handleCloseConsumer(CommandCloseConsumer closeConsumer) {
         }
     }
 
+    @Override
+    protected void handleGetLastMessageId(CommandGetLastMessageId getLastMessageId) {
+        checkArgument(state == State.Connected);
+
+        CompletableFuture<Consumer> consumerFuture = consumers.get(getLastMessageId.getConsumerId());
+
+        if (consumerFuture != null && consumerFuture.isDone() && !consumerFuture.isCompletedExceptionally()) {
+            Consumer consumer = consumerFuture.getNow(null);
+            long requestId = getLastMessageId.getRequestId();
+
+            Position position = consumer.getSubscription().getTopic().getLastMessageId();
+
+            log.info("[{}] [{}][{}] Get LastMessageId {}", remoteAddress,
 
 Review comment:
   info is a bit loud for this. debug would be better.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services