Max Breuer
02/06/2024, 9:33 AMMax Breuer
02/06/2024, 9:34 AMpublic class BatchPropsSource extends RichSourceFunctionBatchStreamProps {
private volatile BatchStreamProps currentBatch = null;
private volatile boolean isRunning = true;
@Override
public void run(SourceContextBatchStreamProps ctx) throws Exception {
while (isRunning) {
if (currentBatch != null) {
ctx.collect(currentBatch);
currentBatch = null;
}
}
}
@Override
public void cancel() {
isRunning = false;
}
public void addBatch(BatchStreamProps batch) {
currentBatch = batch;
}
}
I call the addBatch method from my RPC receiver class whenever a new batch is available