I have written a Kafka consumer using Akka Streams:
RestartSource.withBackoff(consumerResetProps(),
() -> Consumer.committablePartitionedSource(consumerProps(), Subscriptions.topics(topics))
.mapAsyncUnordered(parallelism, pair -> pair.second()
.via(flow())
.runWith(Committer.sink(commiterProps()), system)))
.toMat(Sink.ignore(), Keep.both())
.run(system);
I want this consumer to be active only during specific times of the day (e.g., from 1 AM to 4 AM) and be turned off during the rest of the day. Does Akka Streams provide a built-in way to schedule this kind of behavior, or is there a recommended pattern to achieve this?