0

I have followed the below documentation https://www.confluent.io/blog/spring-kafka-can-your-kafka-consumers-handle-a-poison-pill/ to handle deserialization exceptions. It works fine, the message gets logged and move forward, but everytime I restart the server the bad messages are logged again. Is there a way I can skip/acknowledge the bad message once it is logged so that it doesnt get picked up again on restart the server

Consumer YAML 
spring:
  kafka:
    bootstrap-servers: localhost:9092
    consumer:
      # Configures the Spring Kafka ErrorHandlingDeserializer that delegates to the 'real' deserializers
      key-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
      value-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
    properties:
      # Delegate deserializers
      spring.deserializer.key.delegate.class: org.apache.kafka.common.serialization.StringDeserializer
      spring.deserializer.value.delegate.class: org.sprngframework.kafka.support.serializer.JsonDeserializer

Also, NOTE:= From the above, in logs I see it gives a warn that spring.deserializer.value.delegate.class is given -> but not a known config.

Have also confgured this

@Bean
@Configuration
@EnableKafka
public class KafkaConfiguration {

  /**
   * Boot will autowire this into the container factory.
   */
  @Bean
  public LoggingErrorHandler errorHandler() {
    return new LoggingErrorHandler();
  }
}

Could someone please advise on the same

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 1
    What version of Spring for Apache Kafka are you using? With recent versions (since 2.3), the offset will be committed after the error handler returns. – Gary Russell Jul 02 '21 at 14:21
  • Ok, thanks. Seems consumer group offset isn't moving ahead Using spring Kafka 2.5.7 – Shreya Garg Jul 03 '21 at 16:58

0 Answers0