FeeLGooD
FeeLGooD

Reputation: 505

Is there any way I can only seek 1 message from the old offset?

I would like to know is there any way I can only seek 1 message from the old offset? Since I only want to reprocess 1 message.

Upvotes: 1

Views: 119

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121550

You should implement ConsumerSeekAware and in its:

/**
 * When using group management, called when partition assignments change.
 * @param assignments the new assignments and their current offsets.
 * @param callback the callback to perform an initial seek after assignment.
 */
void onPartitionsAssigned(Map<TopicPartition, Long> assignments, ConsumerSeekCallback callback);

perform desired -1 on the required partition with its offset as a value from that assignments map.

Upvotes: 2

Related Questions