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 2017/10/24 00:29:37 UTC
[GitHub] rdhabalia commented on a change in pull request #848: Allow consumer to seek to message id from within Pulsar client
rdhabalia commented on a change in pull request #848: Allow consumer to seek to message id from within Pulsar client
URL: https://github.com/apache/incubator-pulsar/pull/848#discussion_r146427018
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -675,6 +680,43 @@ protected void handleUnsubscribe(CommandUnsubscribe unsubscribe) {
}
@Override
+ protected void handleSeek(CommandSeek seek) {
+ checkArgument(state == State.Connected);
+
+ CompletableFuture<Consumer> consumerFuture = consumers.get(seek.getConsumerId());
+
+ // Currently only seeking on a message id is supported
+ if (!seek.hasMessageId()) {
+ ctx.writeAndFlush(
+ Commands.newError(seek.getRequestId(), ServerError.MetadataError, "Message id was not present"));
+ return;
+ }
+
+ if (consumerFuture != null && consumerFuture.isDone() && !consumerFuture.isCompletedExceptionally()) {
+ Consumer consumer = consumerFuture.getNow(null);
+ Subscription subscription = consumer.getSubscription();
+ MessageIdData msgIdData = seek.getMessageId();
+// MessageIdImpl msgId = MessageIdImpl.earliest
Review comment:
can we remove this comment?
----------------------------------------------------------------
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