Arun Kumar
Arun Kumar

Reputation: 13

Spring Kafka replay old messages

I have requirement to replay old Kafka offsets incase of any issue. Is there any API available in spring Kafka to replay old offset of a topic?

Upvotes: 0

Views: 2064

Answers (1)

Lachezar Balev
Lachezar Balev

Reputation: 12021

Yes, there is. Have a look at ConsumerSeekAware. The usage is described here. Namely, about this method:

void registerSeekCallback(ConsumerSeekCallback callback);

in the docs is written:

called when the container is started; this callback should be used when seeking at some arbitrary time after initialization. You should save a reference to the callback; if you are using the same listener in multiple containers (or in a ConcurrentMessageListenerContainer) you should store the callback in a ThreadLocal or some other structure keyed by the listener Thread.

The callback itself is documented here.

Upvotes: 2

Related Questions