How to properly configure dead letter queue for a particular queue?

Hello,

I’m trying to configure a dead letter queue for a particular queue:

  sqs_event(:generate_queue,
    queue_properties: {
      redrive_policy: {
        deadLetterTargetArn: ref(:shared_queue_name),
        maxReceiveCount: 3
      }.to_json
    }
  )
  def analysis
    puts "analysis job called"
  end

I’ve also tried other variants, but nothing works – the deploy fails and the rollback happens.

The .to_json shouldn’t be there. Unsure if you have other things like depends_on and a configured timeout that is less than the SQS queue default timeout per docs Jets SQS Event

Here’s a working jets project example: tongueroo/jets-sqs-dead-letter

That worked perfect. Thank you for opening an example repo. Do you recommend having a dlq for every simple queue? Or share it across different queues?

RE: Do you recommend having a dlq for every simple queue? Or share it across different queues?

Unsure. No opinion.

@tung It seems that is not possible to reference a shared queue that uses a dead letter queue, e.g:

# ...
  sqs_event(ref(:shared_queue_name),
    queue_properties: {
      redrive_policy: {
        dead_letter_target_arn: ref(:dead_letter),
        max_receive_count: 3,
    }})
  def run
   puts "!"
  end
# ...

If I try to generate a queue by replacing ref(:shared_queue_name) with :generate_queue, the deploy succeeds.