Keep it consistent with spring.kafka.streams.application-id.
https://github.com/spring-projects/spring-boot/blob/4c4fdb35e9b7e4d83405355e75b26b2c20b5d380/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaStreamsAnnotationDrivenConfiguration.java#L63-L76
Comment From: wilkinsona
Seems sensible to me. Thanks, @quaff. WDYT, @garyrussell?
Comment From: garyrussell
I don't have any serious objections; but the consumer factory's group.id is just a default.
It's generally recommended to set the group id (either via the id or groupId property on each @KafkaListener).
It is not good practice to use the default (when multilple listeners are present) because multiple listeners would be placed in the same group, which would cause an unnecessary rebalance on all listeners when one is initiated on one of the listeners.
Another benefit of providing the id property is that you can manage the listener container's lifecycle via the KafkaListenerEndpointRegistry.
Comment From: wilkinsona
Thanks, @garyrussell. In light of that explanation, I'm less sure that this makes sense now. The group-id and application-id seem to have quite different roles and I'm not sure that spring.application.name is a good default for the group ID. I'm leaning towards declining now. Let's see what the rest of the team thinks.
Comment From: garyrussell
Just to clarify further, in Kafka Streams, the application.id streams property is indeed used by kafka-streams to populate the consumer's group.id.
There is no equivalent behavior for the regular consumer when not using streams.
Comment From: quaff
At least it has one advantage, we could ignore @KafkaListener(groupId) for @SpringBootTest tests.
According to my experience, many applications only contains one @KafkaListener, use spring.application.name as groupId is idiomatic.
Comment From: philwebb
We discussed this as a team today and given https://github.com/spring-projects/spring-boot/pull/37441#issuecomment-1723604951 we don't think that we should automatically set the group-id to the application name.
Thanks anyway for the PR @quaff!