In relation with : this question
I'm trying to read a compacted topic via a @KafkaListener. I'd like every consumers to read the whole topic each time.
I can not generate an unique groupId each for each consumers. So I wanted to use a null groupid.
I've tried to configure the container and the consumer to set the groupId to null, but neither worked.
Here is my Container configuration :
ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
configurer.configure(factory, kafkaConsumerFactory);
// Set ackMode to manual and never commit, we are reading from the beginning each time
factory.getContainerProperties().setAckMode(ContainerProperties.AckMode.MANUAL);
factory.getContainerProperties().setAckOnError(false);
// Remove groupId, we are consuming all partitions here
factory.getContainerProperties().setGroupId(null);
// Enable idle event in order to detect when init phase is over
factory.getContainerProperties().setIdleEventInterval(1000L);
Also tried to force the consumer configuration :
Map<String, Object> consumerProperties = sprinfKafkaProperties.buildConsumerProperties();
// Override group id property to force "null"
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, null);
ConsumerFactory<Object, Object> kafkaConsumerFactory = new DefaultKafkaConsumerFactory<>(consumerProperties);
When I'm setting the container groupId to null, a default with the listener id is used.
When I'm forcing the consumer to a null groupId property, I've got an error : No group.id found in consumer config, container properties, or @KafkaListener annotation; a group.id is required when group management is used.