0

I'm using Java CDK to create a queue and a dead-letter-queue (DLQ) in AWS.

In my DLQ, I need to set the Redrive allow policy to enabled so that it can be used as DLQ, but I can't find the function in CDK that allows me to set it.

        Queue queueDlq = Queue.Builder.create(this, "queue-dlq")
                .build();
        Queue queue = Queue.Builder.create(this, "queue")
                .deadLetterQueue(DeadLetterQueue.builder()
                        .queue(queueDlq)
                        .maxReceiveCount(5)
                        .build())
                .build();

When I deploy this code, both queues are created. The main queue has the Dead-letter queue set correctly, but the DLQ doesn't have Redrive allow policy enabled to allow it to receive the messages.

Caesar
  • 9,483
  • 8
  • 40
  • 66
  • there's an example here https://docs.aws.amazon.com/cdk/api/v2/java/index.html?software/amazon/awscdk/services/sqs/DeadLetterQueue.html - but it looks pretty like your code. Are you sure you actually receive messages unsuccessfully in "queue"? – zapl Sep 21 '22 at 20:37
  • You need to use: DeadLetterQueue deadLetterQueue = DeadLetterQueue.builder() The deadletterqueue is a different kind of sqs and not the same as the default sqs queue – Faruk Ada Sep 24 '22 at 15:28

0 Answers0