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 SwitchSourceEvent and 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, HybridSourceReader
sends SourceReaderFinishedEvent to 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
ConstructorsConstructorDescriptionHybridSourceReader(org.apache.flink.api.connector.source.SourceReaderContext readerContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSplits(List<HybridSourceSplit> splits) voidclose()voidhandleSourceEvents(org.apache.flink.api.connector.source.SourceEvent sourceEvent) voidnotifyCheckpointAborted(long checkpointId) voidnotifyCheckpointComplete(long checkpointId) voidorg.apache.flink.core.io.InputStatuspollNext(org.apache.flink.api.connector.source.ReaderOutput output) snapshotState(long checkpointId) voidstart()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.api.connector.source.SourceReader
pauseOrResumeSplits
-
Constructor Details
-
HybridSourceReader
public HybridSourceReader(org.apache.flink.api.connector.source.SourceReaderContext readerContext)
-
-
Method Details
-
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
- Specified by:
snapshotStatein interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
notifyCheckpointComplete
- 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
- Specified by:
notifyCheckpointAbortedin interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
Exception
-
isAvailable
- Specified by:
isAvailablein interfaceorg.apache.flink.api.connector.source.SourceReader<T,HybridSourceSplit>
-
addSplits
- 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
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-