Ubaid Khanzada
Ubaid Khanzada

Reputation: 1

Consume message from dead letter queue manually | Spring cloud stream kafka

I configured the default DLQ as following:

spring:
  cloud:
    stream:
      kafka:
        bindings:
          input:
            consumer:
              enable-dlq: true
              dlq-name: dlq-topic
              dlq-partitions: 1

the failed messages successfully sent to the dead letter queue. Now I want to analyze the failure cause and start the consumer to listen from dead letter queue topic( after fixing the failure cause ) But the problem is that kafka consumer listen the message as soon as message is published to topic. How can i tackle this problem?

In easy way i want to create an endpoint which triggers by user after fixing the failure cause And that endpoint will be responsible to start kafka consumer to listen message from dlq.

Upvotes: 0

Views: 906

Answers (1)

sobychacko
sobychacko

Reputation: 5924

I assume you already have a consumer provisioned to consume from the DLQ topic. To accomplish what you are asking, you may want to start the app with this consumer binding stopped for this DLQ consumer and then only start it when you are ready to consume the record. You can programmatically stop/start or use actuator endpoints to do so. Please take a look at this reference docs section for more details.

Upvotes: 0

Related Questions