1

我想知道有什么办法只能从旧的偏移量中寻找 1 条消息吗?因为我只想重新处理 1 条消息。

4

1 回答 1

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的操作。partitionoffsetassignments

于 2017-04-03T23:37:48.263 回答