apache-kafkakafka-consumer-apikafka-partition

Does Kafka supports different consumers reads the same partition with different offsets?


Does Kafka supports different consumers reads the same partition with different offsets?

A partition:

              |------------Consumer 2, offset 2
+---+---+---+---+----+
| 0 | 1 | 2 | 3 | .. |  <---- a particular partition
+---+---+---+---+----+
  |______Consumer 1, offset 1

Is it possible?

Update (from official Kafka ):

enter image description here


Solution

  • Sure. As you can see from the picture C1 and C3 are consuming P0. Maybe C1 read 10 messages and C3 read 5. The only important thing is that C1 and C3 are not in the same consumer group. Two consumers from the same group cannot consume the same partition.