I am new to flink and looking for CustomSource in python to invoke webapi for every 1 minute.
Below is one of the sample that I tried but it didn't work for me.
I understand we should implement SourceFunction and override the run and cancel methods.
class DataGenerator(SourceFunction): def init(self): super().init(self) self._num_iters = 1000 self._running = True
def run(self, ctx):
counter = 0
while self._running and counter < self._num_iters:
ctx.collect('Hello World')
counter += 1
def cancel(self):
self._running = False
Not sure if Python supports custom source implementation.
I found couple of example using JAVA but not with python.
If someone can provide me an example implementing the custom source that would be great.
I am looking for an example implementing Custom Source function using python and flink.
I have gone through couple of samples and the example provided below.