Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign client-id to a particular kafka producer or topic?

I know that quotas are based on client-id. Basically I want to run the kafka-producer-perf-test with a particular client id to test whether the quotas work properly.

How can I assign a client-id for a particular producer (or) partition?

like image 263
brokendreams Avatar asked Mar 10 '23 11:03

brokendreams


1 Answers

When creating a producer, you can assign a unique value to client.id property

Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("client.id", "testclient001");
//set any additional properties.
Producer<String, GenericRecord> producer = new KafkaProducer<String, GenericRecord>(props);
like image 94
Vinod Avatar answered Apr 09 '23 09:04

Vinod