sijie 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_r167588712
########## 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, + consumer.getSubscription().getTopic().getName(), consumer.getSubscription().getName(), position); + MessageIdData messageId = MessageIdData.newBuilder() Review comment: I think it should be at client side, because currently "partition" related logic is at client side. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services