'Manipulate offsets of Kafka consumer from REST

Applications which have Kafka consumers could have REST services as part of deployment.

The problem here is that manipulation of offsets cannot happen when the consumer group is active and requires the consumer group to be inactive by stopping the application. This would also mean the REST services would be down for that amount of time.

Please suggest if there are ways to have them in the same deployment and yet allow offset manipulation without downtime or should they be not bundled altogether, thanks.



Solution 1:[1]

manipulation of offsets cannot happen when the consumer group is active and requires the consumer group to be inactive by stopping the application.

Since you tagged the question with , I assume you are using Spring for Apache Kafka.

You can stop the listener container(s), which will close the consumer(s); then restart them.

You can also manipulate the offsets programmatically, while the consumers are running.

https://docs.spring.io/spring-kafka/docs/current/reference/html/#seek

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gary Russell