Spring Kafka Batch Option: ClassCastException using SeekToCurrentBatchErrorHandler

PVS
Trying to configure the Factory as below:
private ConcurrentKafkaListenerContainerFactory<Integer, String> getKafkaContainerFactory()
        throws IOException {
    ConcurrentKafkaListenerContainerFactory<Integer, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
    factory.setConsumerFactory(this.getConsumerFactory());//DefaultKafkaConsumerFactory
    factory.setAutoStartup(true);
    ContainerProperties props = factory.getContainerProperties();
    props.setAckMode(AbstractMessageListenerContainer.AckMode.BATCH);
    props.setAckOnError(false);
    props.setBatchErrorHandler(new SeekToCurrentBatchErrorHandler());
    return factory;
}

with:

Kafka version : 1.0.2, spring-kafka:2.1.10.RELEASE & springBootVersion = '2.0.5.RELEASE'

getting the following exception:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is java.lang.ClassCastException: org.springframework.kafka.listener.SeekToCurrentBatchErrorHandler cannot be cast to org.springframework.kafka.listener.ErrorHandler

Appreciate your help.

Gary Russell

To create batch listener containers, add factory.setBatchListener(true);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Spring Kafka Property for setting SeekToCurrentBatchErrorHandler

ClassCastException in spring-kafka-test using `merger()`

Spring Batch and Kafka

Batch Consumer not working with Kafka for CloudEvents using Spring Cloud Stream

How to resolve ClassCastException in MultiResourceItemReader Spring Batch

Integrate kafka Consumer spring batch

Using Kafka for batch job replacement

Spring kafka integration properties for batch listener using application.yml/properties

Fetch the records from Kafka topic within specific date range using KafkaItemReader (Spring batch job to read kafka streams)

using stepExecution in Spring Batch

Spring Kafka - which batch error handler to use?

Problem Serializing Spring batch Kafka ChunkRequest

Spring Integration and Spring Batch using Annotations [Spring-Batch-Integration]

Spring Batch using eclipse or STS

Spring batch multithreading using partitioning

batch update using jdbcTemplate in spring

Spring Batch Using CompositeItemWriter and CompositeItemProcessor

Multiple consumers using spring kafka

Spring and Kafka: Using the same binding for Kafka Producer and Kafka Streams

Using EmbeddedKafkaBroker with spring integration and spring kafka

How to increase the number of messages consumed by Spring Kafka Consumer in each batch?

What is the latest (2019) preferred way to integrate spring batch with kafka?

How to wait for full Kafka-message batch with Spring Boot?

spring kafka cloud stream: limit retry attempts in batch mode

Spring kafka batch listener prints whole consumer record

How to do Stateful retry with spring kafka batch listener

Error handling in Spring Cloud Stream Kafka in Batch mode

Non-blocking retries with Spring Kafka batch consumer

Spring jpa throws ClassCastException when using custom Query