...
FLIP-27 sources are non-trivial to implement. At the same time, it is frequently required to generate arbitrary events with a "mock" source. Such requirement arises both for Flink users, in the scope of demo/PoC projects, and for Flink developers when writing tests. The go-to solution for these purposes so far was using pre-FLIP-27 APIs and implementing data generators as SourceFunctions
.
While the new FLIP-27 Source
interface introduces important additional functionality, it comes with significant complexity that presents a hurdle for Flink users for implementing drop-in replacements of the SourceFunction
-based data generators. Meanwhile, SourceFunction
is effectively superseded by the Source
interface and needs to be eventually deprecated. To fill this gap, this FLIP proposes the introduction of a generic data generator source based on the FLIP-27 API.
Public Interfaces
The A new class with the following API will be introduced. Under the hood, it can wrap and delegate to the NumberSequenceSource
utilities.
...
This FLIP introduces a new DataGeneratorSource
class.
The envisioned usage looks like this:
...
- After this feature is introduced, it will be documented and promoted as the recommended way to write data generators.
- A list of Flink tests that currently use the
SourceFunction
API will be compiled and follow-up tickets for migration will be created.
...
- It introduces another level of indirection and is less intuitive to use
- It does not allow to promote best practices of assigning watermarks (see this discussion)
...