в чем разница в указании группы у потребителя
spring.kafka.consumer.group-id
против указания на @KafkaListener?
@KafkaListener(topic="test", group = "test-grp")
в чем разница в указании группы у потребителя
spring.kafka.consumer.group-id
против указания на @KafkaListener?
@KafkaListener(topic="test", group = "test-grp")
См. Javadocs для свойства group
; это не имеет ничего общего с кафкой _2 _...
/**
* If provided, the listener container for this listener will be added to a bean
* with this value as its name, of type {@code Collection<MessageListenerContainer>}.
* This allows, for example, iteration over the collection to start/stop a subset
* of containers.
* @return the bean name for the group.
*/
Он был переименован в containerGroup
в 1.3 / 2.0.
Эти версии выпуска также предоставляют ...
/**
* 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 {@link #groupId() groupId} is not provided, use the {@link #id() id} (if
* provided) as the {@code group.id} property for the consumer. Set to false, to use
* the {@code group.id} from the consumer factory.
* @return false to disable.
* @since 1.3
*/
boolean idIsGroup() default true;
Раньше для каждого слушателя требовалась фабрика контейнеров / фабрика потребителей; они позволяют использовать один экземпляр фабрики и переопределять group.id
.