javaapache-kafkakafka-consumer-apispring-kafkaconsumer

Consumer not listen message from retry topic


I use Spring-Kafka 2.7.7 with @RetryableTopic to re-process messages from my two topics, MyTopic1 and MyTopic2, after some time

@RetryableTopic(
    attempts ="3",
    backoff = @Backoff(delay=1000),
    autoCreateTopics = "false")
)
@KafkaListener(topics = "myTopic1",
public void processMessage(MyPojo1 message) {
   // ... message processing
}

@RetryableTopic(attempts ="3",
                backoff = @Backoff(delay=1000),
                autoCreateTopics = "false"))
@KafkaListener(topics = "myTopic2")
public void processMessage(MyPojo2 message) {
   // ... message processing
}

@DltHandler
public void DltHandler1(MyPojo1 message) {
    // ... message processing
}

@DltHandler
public void DltHandler1(MyPojo2 message) {
    // ... message processing
}

I have Retry-Mytopic1-0, Retry-Mytopic1-1, Retry-Mytopic1-2, MyTopic1-DLT and Topic for MyTopic2 But I have two problems

  1. After writing a message to the Topik Retry-Mytopic1-0, I get a message:

    Seek to Current AFTER Exception; NESSTED Exception is org.springframework.kafka.listenerexecitationfailedException: Listener Failed; NESSTED Exception is org.springframework.kafka.listener.kafkabackoffexception: Partition 0 from Topic Retry-Mytopic1-0 is not Ready for Consumption, Backing OFF For Approx. 990 Millis.

    And that's right, the consumer saw that the processing time did not occur But in the future, processing does not occur, on this information message everything ends

  2. How can I configure @dlthandler for each DLT-Topic? After all, they get different DTO in the input


Solution

    1. 2.7.x is no longer supported; upgrade to a supported version (2.9.12 or later) and report back if you still see a problem. Otherwise, DEBUG logging might help you. https://spring.io/projects/spring-kafka#support

    2. You would have to put each listener in its own class to have multiple DLT handlers.