I am starting to work with Spring Boot 2 and Spring Kafka, I don't quite understand what's the difference between group id
, Client id
, and id in
in KafkaListener
interface.
I know group ID is used by Kafka broker to manage multiple Consumer in the same group, but what about the others? what advantage do I get by setting them? where can I see the effect of setting or not setting them?
Based on their java doc :
/**
* The unique identifier of the container managing for this endpoint.
* <p>If none is specified an auto-generated one is provided.
* @return the {@code id} for the container managing for this endpoint.
* @see org.springframework.kafka.config.KafkaListenerEndpointRegistry#getListenerContainer(String)
*/
String id() default "";
/**
* Override the {@code group.id} property for the consumer factory with this value
* for this listener only.
* @return the group id.
* @since 1.3
*/
String groupId() default "";
/**
* When provided, overrides the client id property in the consumer factory
* configuration. A suffix ('-n') is added for each container instance to ensure
* uniqueness when concurrency is used.
* @return the client id prefix.
* @since 2.1.1
*/
String clientIdPrefix() default "";