1.手动设置TopicPartition=>offset
//手动设置TopicPartition=>offset foreach (TopicPartition partition in consumer.Assignment) { if (partition.Partition.Value == 13) { TopicPartitionOffset offset = new TopicPartitionOffset(partition, 27060); consumer.Seek(offset); } }
2.手动指定kafka的Partition
List<TopicPartition> list = new List<TopicPartition>(); for (int i = 0; i < 30; i++) { TopicPartition p = new TopicPartition("test.pdf", new Partition(i)); list.Add(p); } consumer.Assign(list);
标签:TopicPartition,C#,Partition,new,kafka,offset,操作,consumer From: https://www.cnblogs.com/yellow3gold/p/17375015.html