ruanhang1993 commented on code in PR #76:
URL:
https://github.com/apache/flink-connector-kafka/pull/76#discussion_r1469304314
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/KafkaSourceBuilder.java:
##########
@@ -350,6 +352,26 @@ public KafkaSourceBuilder<OUT> setValueOnlyDeserializer(
return this;
}
+ /**
+ * Sets the optional {@link RecordEvaluator eofRecordEvaluator} for
KafkaSource.
+ *
+ * <p>When the evaluator is specified, it is invoked for each
de-serialized record to determine
+ * whether the corresponding split has reached end of stream. If a record
is matched by the
+ * evaluator, the source would not emit this record as well as the
following records in the same
+ * split.
+ *
+ * <p>Note that the evaluator works jointly with the stopping offsets
specified by the {@link
+ * #setBounded(OffsetsInitializer)} or the {@link
#setUnbounded(OffsetsInitializer)}. The source
+ * stops consuming from a split when any of these conditions is met.
+ *
+ * @param eofRecordEvaluator a {@link RecordEvaluator recordEvaluator}
+ * @return this KafkaSourceBuilder.
+ */
+ public KafkaSourceBuilder<OUT> setEofRecordEvaluator(RecordEvaluator<OUT>
eofRecordEvaluator) {
Review Comment:
Hi, @mas-chen .
I read some parts about the `stoppingOffsetsInitializer`. Actually the
`eofRecordEvaluator` does the same job as `stoppingOffsetsInitializer`. We want
to use both `eofRecordEvaluator` and `stoppingOffsetsInitializer` to decide
when to stop reading and support to use them in one same source together.
But I find the method `KafkaSourceBuilder<OUT>
setUnbounded(OffsetsInitializer stoppingOffsetsInitializer)` in builder, which
supports to set a `stoppingOffsetsInitializer` in an unbounded source. I want
to keep the same behavior as `stoppingOffsetsInitializer` and do not add the
limitation for `eofRecordEvaluator`. What do you think?
Looking forward to your option.
--
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]