You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by kant kodali <ka...@gmail.com> on 2017/03/31 01:09:52 UTC

Can multiple Kafka consumers read from the same partition of same topic by default?

Hi All,

Can multiple Kafka consumers read from the same partition of same topic by
default? By default, I mean since group.id is not mandatory I am wondering
if I spawn multiple kafka consumers without specifying any group.id and
give them the same topic and partition name will they be able to read from
the same partition? I understand that If I give different group names for
each Kafka consumer then all the consumers can read from the same partition.

Thanks!

Re: Can multiple Kafka consumers read from the same partition of same topic by default?

Posted by "Matthias J. Sax" <ma...@confluent.io>.
It's explained in the JavaDocs:

https://kafka.apache.org/0102/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html

Also here:

http://docs.confluent.io/current/clients/consumer.html


If you have any more up question, just follow up :)


-Matthias

On 3/30/17 9:07 PM, kant kodali wrote:
> Hi,
> 
> Thanks Can you explain little bit whats happening underneath? Does Kafka
> creates different group.id's by default when group.id's are not set ? When
> specified a group only one consumer can consumer from the group the for a
> particular partition right?
> 
> Thanks!
> 
> On Thu, Mar 30, 2017 at 9:00 PM, Matthias J. Sax <ma...@confluent.io>
> wrote:
> 
>> Yes, you can do that.
>>
>> -Matthias
>>
>>
>>
>> On 3/30/17 6:09 PM, kant kodali wrote:
>>> Hi All,
>>>
>>> Can multiple Kafka consumers read from the same partition of same topic
>> by
>>> default? By default, I mean since group.id is not mandatory I am
>> wondering
>>> if I spawn multiple kafka consumers without specifying any group.id and
>>> give them the same topic and partition name will they be able to read
>> from
>>> the same partition? I understand that If I give different group names for
>>> each Kafka consumer then all the consumers can read from the same
>> partition.
>>>
>>> Thanks!
>>>
>>
>>
> 


Re: Can multiple Kafka consumers read from the same partition of same topic by default?

Posted by kant kodali <ka...@gmail.com>.
Hi,

Thanks Can you explain little bit whats happening underneath? Does Kafka
creates different group.id's by default when group.id's are not set ? When
specified a group only one consumer can consumer from the group the for a
particular partition right?

Thanks!

On Thu, Mar 30, 2017 at 9:00 PM, Matthias J. Sax <ma...@confluent.io>
wrote:

> Yes, you can do that.
>
> -Matthias
>
>
>
> On 3/30/17 6:09 PM, kant kodali wrote:
> > Hi All,
> >
> > Can multiple Kafka consumers read from the same partition of same topic
> by
> > default? By default, I mean since group.id is not mandatory I am
> wondering
> > if I spawn multiple kafka consumers without specifying any group.id and
> > give them the same topic and partition name will they be able to read
> from
> > the same partition? I understand that If I give different group names for
> > each Kafka consumer then all the consumers can read from the same
> partition.
> >
> > Thanks!
> >
>
>

Re: Can multiple Kafka consumers read from the same partition of same topic by default?

Posted by "Matthias J. Sax" <ma...@confluent.io>.
Yes, you can do that.

-Matthias



On 3/30/17 6:09 PM, kant kodali wrote:
> Hi All,
> 
> Can multiple Kafka consumers read from the same partition of same topic by
> default? By default, I mean since group.id is not mandatory I am wondering
> if I spawn multiple kafka consumers without specifying any group.id and
> give them the same topic and partition name will they be able to read from
> the same partition? I understand that If I give different group names for
> each Kafka consumer then all the consumers can read from the same partition.
> 
> Thanks!
>