user3103957
user3103957

Reputation: 848

Kafka - Singe producer-single consumer-multiple partition with only one copy

I have started studying Kafka. Let consider the below context:

There is a topic. Only one producer brings in messages. The topic has three partitions. The replication factor is exactly one. I have a consumer group which has exactly one consumer. Round robin method is used to store messages by the cluster.

Is the above setup possible? I am getting contracting answers (answers are: the setup is possible where all data can be read without data loss AND the setup is not possible).

Since a consumer in a consumer group can read only one partition, the consumer can not read all the messages and hence the complete data can not be read?

Can someone please help.

Thanks!

Upvotes: 0

Views: 49

Answers (1)

Michael Heil
Michael Heil

Reputation: 18525

The scenario you have described is absolutely possible.

A single producer can send messages to all three partitions in a round-robin fashion. This can, for example, be achieved if your messages do not have any keys.

Also, a single consumer is capable of reading multiple partitions within the same topic. I guess you were confused by the fact that a single topic partitioncan only be consumed by one consumer within a consumer group. But that does not impact the other way around: one consumer reading multiple partitions.

Upvotes: 2

Related Questions