Naturally, streaming apps are unbounded, but I have a new use case where I need to consume an exact number of messages or less (configurable, for example, 100 messages) from a Kafka topic. Then the app should stop.
The motivation is very simple, the flow is rarely used and no need for real-time, so there is no reason to have a permanent streaming app.
It is enough to invoke the app once in a while.
Is there a way to implement it using FlinkKafkaConsumer?
Adding a counter that will kill the app when it reaches the required number of messages is an option, but I prefer to use something more elegant.