Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does kafka producer have client.id?

How is a client.id used by a producer? My understanding was that a kafka consumer needs client.id in order to associate it with offsets. For example an application could be using the "abc123" client.id to read from a topic and if it fails, it can be restarted with that same client.id and continue reading from where it left off.

On the other hand my understanding was that producers always write to the end of the topic. So, why would a kafka producer need a client.id?

like image 623
pavel_orekhov Avatar asked Oct 11 '25 09:10

pavel_orekhov


1 Answers

I think you are confusing client.id and group.id.

The group.id setting is used by consumers to indicate the group they belong to and commit offsets so they can be restarted and continue where they left from.

On the other hand, client.id is used to indicate the identity of clients. It can be used by all client types (Producer, Consumer, Admin, Connect and Streams). It's helpful to identify a specific instance in metrics or logs and can also be used to set quotas for example.

like image 142
Mickael Maison Avatar answered Oct 15 '25 04:10

Mickael Maison