Search code examples
apache-kafkaspring-kafkakafka-producer-api

Multiple instances of kafka producer


I understand that multiple instances of a producer application can be started to produce data to a topic. What configuration changes are required for this? Do i need different client_id? Without any changes , it works. So not sure if there are any benefit of changing client id or any other config param? Thanks,


Solution

  • The client id is simply used for logging on the server.

    The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.

    So it's not very important unless you have many producers in the same application.

    To get a different client id for each producer, you would need a producer factory for each.

    On the consumer side, you can specify a client id at the container (or @KafkaListener) level.