Principle:Apache Flink Hybrid Source Initialization
| Knowledge Sources | |
|---|---|
| Domains | Stream_Processing, Source_Architecture |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
An initialization mechanism that creates the hybrid sources enumerator and reader wrappers, bootstrapping the first source in the chain via FLIP-27 source framework hooks.
Description
Hybrid Source Initialization creates the coordination infrastructure for source switching. The HybridSourceSplitEnumerator wraps individual source enumerators behind a SplitEnumeratorContextProxy that translates between hybrid-level splits and source-specific splits. The HybridSourceReader starts in an uninitialized state (currentSourceIndex = -1) and waits for a SwitchSourceEvent to activate its first reader.
The enumerator bootstraps by calling switchEnumerator() during start(), which creates the first sources enumerator and begins split discovery.
Usage
This principle is internal to the HybridSource framework. Users trigger it by calling env.fromSource(hybridSource, ...).
Theoretical Basis
// Abstract initialization
function initializeHybridSource():
enumerator = new HybridSourceSplitEnumerator(sources, startIndex=0)
reader = new HybridSourceReader(readerContext) // sourceIndex = -1
// On enumerator.start():
enumerator.switchEnumerator() // activates source[0]
enumerator.sendSwitchEvent(source[0]) to all readers
// On reader.handleSourceEvents(SwitchSourceEvent):
reader.setCurrentReader(0) // creates source[0]'s reader