Reputation: 91
I am trying to create an AWS SQS standard queue locally with localstack
and using ruby's aws-sdk-sqs
library. I am running into an error when passing in parameters into the RedrivePolicy
attribute. I believe I am using the API documentation correctly as described here.
I did some research and it seems that the parameters passed into the RedrivePolicy
attribute should be JSON-formatted but I could be wrong.
This is my code:
c = Aws::SQS::Client.new
c.create_queue(queue_name: "my_queue", attributes: {"RedrivePolicy" => "{\"maxReceiveCount\":\"5\"}"})
And this is what I'm getting:
Aws::SQS::Errors::MalformedQueryString (MalformedQueryString; see the SQS docs.)
Thanks in advance.
Upvotes: 1
Views: 1190
Reputation: 3765
To specify a RedrivePolicy you also have to give it a deadLetterTargetArn where it will put the failed messages.
So you'd need to create that queue first, then pass it's Arn along to the second call:
c.create_queue(queue_name: "my_queue",
attributes: {"RedrivePolicy" => "{\"maxReceiveCount\":\"5\",
\"deadLetterTargetArn\": \" #{deadLetterArn}\"}"})
Upvotes: 2