Class HybridSourceReader<T>
- java.lang.Object
-
- org.apache.flink.connector.base.source.hybrid.HybridSourceReader<T>
-
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
public class HybridSourceReader<T> extends Object implements org.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
Hybrid source reader that delegates to the actual source reader.This reader processes splits from a sequence of sources as determined by the enumerator. The current source is provided with
SwitchSourceEventand the reader does not require upfront knowledge of the number and order of sources. At a given point in time one underlying reader is active.When the underlying reader has consumed all input for a source,
HybridSourceReadersendsSourceReaderFinishedEventto the coordinator.This reader does not make assumptions about the order in which sources are activated. When recovering from a checkpoint it may start processing splits for a previous source, which is indicated via
SwitchSourceEvent.
-
-
Constructor Summary
Constructors Constructor Description HybridSourceReader(org.apache.flink.api.connector.source.SourceReaderContext readerContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSplits(List<HybridSourceSplit> splits)voidclose()voidhandleSourceEvents(org.apache.flink.api.connector.source.SourceEvent sourceEvent)CompletableFuture<Void>isAvailable()voidnotifyCheckpointAborted(long checkpointId)voidnotifyCheckpointComplete(long checkpointId)voidnotifyNoMoreSplits()org.apache.flink.core.io.InputStatuspollNext(org.apache.flink.api.connector.source.ReaderOutput output)List<HybridSourceSplit>snapshotState(long checkpointId)voidstart()
-
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
pollNext
public org.apache.flink.core.io.InputStatus pollNext(org.apache.flink.api.connector.source.ReaderOutput output) throws Exception- Specified by:
pollNextin interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>- Throws:
Exception
-
snapshotState
public List<HybridSourceSplit> snapshotState(long checkpointId)
- Specified by:
snapshotStatein interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId) throws Exception- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.common.state.CheckpointListener- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>- Throws:
Exception
-
notifyCheckpointAborted
public void notifyCheckpointAborted(long checkpointId) throws Exception- Specified by:
notifyCheckpointAbortedin interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
Exception
-
isAvailable
public CompletableFuture<Void> isAvailable()
- Specified by:
isAvailablein interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
addSplits
public void addSplits(List<HybridSourceSplit> splits)
- Specified by:
addSplitsin interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
notifyNoMoreSplits
public void notifyNoMoreSplits()
- Specified by:
notifyNoMoreSplitsin interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
handleSourceEvents
public void handleSourceEvents(org.apache.flink.api.connector.source.SourceEvent sourceEvent)
- Specified by:
handleSourceEventsin interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-