public class KafkaSourceReader<T> extends SingleThreadMultiplexSourceReaderBase<Tuple3<T,Long,Long>,T,KafkaPartitionSplit,KafkaPartitionSplitState>
config, context, options, recordEmitter, splitFetcherManager
Constructor and Description |
---|
KafkaSourceReader(FutureCompletingBlockingQueue<RecordsWithSplitIds<Tuple3<T,Long,Long>>> elementsQueue,
java.util.function.Supplier<KafkaPartitionSplitReader<T>> splitReaderSupplier,
RecordEmitter<Tuple3<T,Long,Long>,T,KafkaPartitionSplitState> recordEmitter,
Configuration config,
SourceReaderContext context) |
Modifier and Type | Method and Description |
---|---|
protected KafkaPartitionSplitState |
initializedState(KafkaPartitionSplit split)
When new splits are added to the reader.
|
void |
notifyCheckpointComplete(long checkpointId)
We have an empty default implementation here because most source readers do not have to
implement the method.
|
protected void |
onSplitFinished(Map<String,KafkaPartitionSplitState> finishedSplitIds)
Handles the finished splits to clean the state if needed.
|
List<KafkaPartitionSplit> |
snapshotState(long checkpointId)
Checkpoint on the state of the source.
|
protected KafkaPartitionSplit |
toSplitType(String splitId,
KafkaPartitionSplitState splitState)
Convert a mutable SplitStateT to immutable SplitT.
|
addSplits, close, getNumberOfCurrentlyAssignedSplits, handleSourceEvents, isAvailable, notifyNoMoreSplits, pollNext, start
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
notifyCheckpointAborted
public KafkaSourceReader(FutureCompletingBlockingQueue<RecordsWithSplitIds<Tuple3<T,Long,Long>>> elementsQueue, java.util.function.Supplier<KafkaPartitionSplitReader<T>> splitReaderSupplier, RecordEmitter<Tuple3<T,Long,Long>,T,KafkaPartitionSplitState> recordEmitter, Configuration config, SourceReaderContext context)
protected void onSplitFinished(Map<String,KafkaPartitionSplitState> finishedSplitIds)
SourceReaderBase
onSplitFinished
in class SourceReaderBase<Tuple3<T,Long,Long>,T,KafkaPartitionSplit,KafkaPartitionSplitState>
public List<KafkaPartitionSplit> snapshotState(long checkpointId)
SourceReader
snapshotState
in interface SourceReader<T,KafkaPartitionSplit>
snapshotState
in class SourceReaderBase<Tuple3<T,Long,Long>,T,KafkaPartitionSplit,KafkaPartitionSplitState>
public void notifyCheckpointComplete(long checkpointId) throws Exception
SourceReader
checkpointId
- The ID of the checkpoint that has been completed.Exception
- This method can propagate exceptions, which leads to a failure/recovery for
the task. Not that this will NOT lead to the checkpoint being revoked.CheckpointListener.notifyCheckpointComplete(long)
protected KafkaPartitionSplitState initializedState(KafkaPartitionSplit split)
SourceReaderBase
initializedState
in class SourceReaderBase<Tuple3<T,Long,Long>,T,KafkaPartitionSplit,KafkaPartitionSplitState>
split
- a newly added split.protected KafkaPartitionSplit toSplitType(String splitId, KafkaPartitionSplitState splitState)
SourceReaderBase
toSplitType
in class SourceReaderBase<Tuple3<T,Long,Long>,T,KafkaPartitionSplit,KafkaPartitionSplitState>
splitState
- splitState.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.