Is there a spring.kafka property error handling batches
spring.kafka.listener.type=BATCH
and spring.kafka.listener.ack-mode=BATCH
with SeekToCurrentBatchErrorHandler ? Thanks in advance.
You cannot set it with a property, but you can override Boot's auto-configured container factory like so:
@Bean
public ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(
ConcurrentKafkaListenerContainerFactoryConfigurer configurer,
ConsumerFactory<Object, Object> kafkaConsumerFactory) {
ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
configurer.configure(factory, kafkaConsumerFactory);
factory.setBatchErrorHandler(new SeekToCurrentBatchErrorHandler());
return factory;
}
It will get all the boot properties and you can then further configure the factory as needed.
Collected from the Internet
Please contact javaer1[email protected] to delete if infringement.
Comments