Hi, I'm learning Flink and would appreciate some g...
# troubleshooting
m
Hi, I'm learning Flink and would appreciate some guidance for a specific problem I'd like to solve. I scanned through this channel but could not find sth similar. I receive data via RPC in batches and I have a Flink pipeline to process each batch and return some result. Is it a good practice to implement some kind of a continuously running source that keeps Flink running (I receive a lot of batches quite fast)? I thought about the implementation in this thread which is not working because it doesn't collect events in the while loop. What would be an alternative? Restarting the same Flink job over and over with a lot of overhead?
Copy code
public 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