Class HybridSourceSplitEnumerator
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,,HybridSourceEnumeratorState> org.apache.flink.api.connector.source.SupportsBatchSnapshot
This enumerator delegates to the current underlying split enumerator and transitions to the
next source once all readers have indicated via SourceReaderFinishedEvent that all input
was consumed.
Switching between enumerators occurs by creating the new enumerator via Source.createEnumerator(SplitEnumeratorContext). The start position can be fixed at pipeline
construction time through the source or supplied at switch time through a converter function by
using the end state of the previous enumerator.
During subtask recovery, splits that have been assigned since the last checkpoint will be
added back by the source coordinator. These splits may originate from a previous enumerator that
is no longer active. In that case HybridSourceSplitEnumerator will suspend forwarding to
the current enumerator and replay the returned splits by activating the previous readers. After
returned splits were processed, delegation to the current underlying enumerator resumes.
-
Constructor Summary
ConstructorsConstructorDescriptionHybridSourceSplitEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<HybridSourceSplit> context, List<org.apache.flink.connector.base.source.hybrid.HybridSource.SourceListEntry> sources, int initialSourceIndex, HybridSourceEnumeratorState restoredEnumeratorState) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReader(int subtaskId) voidaddSplitsBack(List<HybridSourceSplit> splits, int subtaskId) voidclose()voidhandleSourceEvent(int subtaskId, org.apache.flink.api.connector.source.SourceEvent sourceEvent) voidhandleSplitRequest(int subtaskId, String requesterHostname) voidnotifyCheckpointAborted(long checkpointId) voidnotifyCheckpointComplete(long checkpointId) snapshotState(long checkpointId) voidstart()
-
Constructor Details
-
HybridSourceSplitEnumerator
public HybridSourceSplitEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<HybridSourceSplit> context, List<org.apache.flink.connector.base.source.hybrid.HybridSource.SourceListEntry> sources, int initialSourceIndex, HybridSourceEnumeratorState restoredEnumeratorState)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState>
-
handleSplitRequest
- Specified by:
handleSplitRequestin interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState>
-
addSplitsBack
- Specified by:
addSplitsBackin interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState>
-
addReader
public void addReader(int subtaskId) - Specified by:
addReaderin interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState>
-
snapshotState
- Specified by:
snapshotStatein interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState> - Throws:
Exception
-
notifyCheckpointComplete
- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.common.state.CheckpointListener- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState> - Throws:
Exception
-
notifyCheckpointAborted
- Specified by:
notifyCheckpointAbortedin interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
Exception
-
handleSourceEvent
public void handleSourceEvent(int subtaskId, org.apache.flink.api.connector.source.SourceEvent sourceEvent) - Specified by:
handleSourceEventin interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.flink.api.connector.source.SplitEnumerator<HybridSourceSplit,HybridSourceEnumeratorState> - Throws:
IOException
-