syhily commented on a change in pull request #17119:
URL: https://github.com/apache/flink/pull/17119#discussion_r701686082



##########
File path: 
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarOrderedPartitionSplitReader.java
##########
@@ -75,7 +78,30 @@ protected void finishedPollMessage(Message<byte[]> message) {
 
     @Override
     protected void startConsumer(PulsarPartitionSplit split, Consumer<byte[]> 
consumer) {
-        initialStartPosition(split, consumer);
+        MessageId latestConsumedId = split.getLatestConsumedId();
+
+        // Reset the start position for ordered pulsar consumer.
+        if (latestConsumedId != null) {
+            StartCursor startCursor = 
StartCursor.fromMessageId(latestConsumedId, false);
+            TopicPartition partition = split.getPartition();
+
+            try {
+                startCursor.seekPosition(
+                        partition.getTopic(), partition.getPartitionId(), 
consumer);

Review comment:
       It's used only for `Exclusive` or `Failover` subscriptions. Only one 
consumer would be used for seeking the start position.




-- 
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]


Reply via email to