我想知道有什么方法我只能从旧的偏移中寻找1条消息吗?因为我只想重新处理1条消息。
答案 0 :(得分:2)
您应该实施ConsumerSeekAware
并在其中:
/**
* 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);
对所需的-1
执行所需的partition
,其offset
作为该assignments
地图的值。