TeaSea
TeaSea

Reputation: 55

Micronaut Kafka Listener : How to schedule kafka consumer poll() with 15 min interval

I want to poll the topic once every 15 minutes. I found out there is a way to do this in kafka-spring with ConcurrentKafkaListenerContainerFactory and with below configuration

factory.getContainerProperties().setIdleBetweenPolls(900000);

Is there any similar configuration available for micronaut Kafka as well?

Upvotes: 1

Views: 527

Answers (1)

Adam Kotwasinski
Adam Kotwasinski

Reputation: 4554

Not in a trivial way.

As of 4.3.0, it looks like Consumer.poll is being called in active loop without any delays (source).

But it looks like you can pause the consumer, so you might need to periodically do the pause-resume flipping in a separate job.

Caveat emptor from Kafka side: pausing the Micronaut Consumer does not interrupt the underlying poll (it's handled separately (source)).

Upvotes: 1

Related Questions