Question: I have an array like this: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10). I want to keep the first three (0, 1, 2), then remove the next two (that is 3, 4), then keep three (6, 7, 8), then remove two (9, 10) until the array is completely looped through.

I'm sure there is an easy solution that i'm just not seeing!

Answer: 
If you use group management, where kafka assigns the partitions, it can't happen - a partition is assigned to one thread only. If you have more threads, they are each consuming from a different partition which each have their own offset.
In you case, your latest committed offset is 21. and Kafka assume your 20 also committed. So when you restart it will start from offset 21. Yes. I remember Gary mention that you either need to stop the container at 20 or put the 20 to some other topic for later reply.