Spring Kafka Property for setting SeekToCurrentBatchErrorHandler

A-D :

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.

Gary Russell :

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.

edited at
0

Comments

0 comments
Login to comment

Related

Spring Kafka and Kafka Streams

spring kafka thorws InstanceAlreadyExistsException exception after setting concurrency > 1

Spring for Kafka 2.3 setting an offset during runtime for specific listener with KafkaMessageListenerContainer

SeekToCurrentBatchErrorHandler support for dead DLQ

Setting profiles in Spring Boot application based on system property

Spring setting application property programmatically

Spring-Kafka Concurrency Property

Spring 3.5 Setting an xml property, handling the default value using PropertyPlaceholderConfigurer

Spring Boot is not setting the @Value property in Jersey's ResourceConfig class

Zookeeper issue in setting kafka

Setting property in Immediate Window not setting?

Setting logback property via spring config + environment variable in spring config

Kubernetes - Setting System property

Spring Kafka Batch Option: ClassCastException using SeekToCurrentBatchErrorHandler

When to use ExponentialBackOffPolicy vs FixedBackOffPolicy when setting retry policy for a kafka consumer in a Spring boot app?

Setting authorizationExceptionRetryInterval for Spring Kafka

Setting an instance property to a static property

Setting a property of a property in a struct?

Setting an array property from a single ${property} in Spring bean

Setting the property in a Map

Setting the property of a property

Notice on setting a property

Mule: Setting a property on a spring bean

setting a property of function javascript

Kafka client id property with spring cloud stream

setting a property in __init__

How do we define kafka request.timeout.ms property in spring kafka properties file

Is Spring Kafka KafkaListener annotation able to take config property as topic name?

Setting AuthExceptionRetryInterval property in Spring Kafka