softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.55k stars 196 forks source link

Missing attributes #158

Closed FreifeldRoyi closed 5 years ago

FreifeldRoyi commented 6 years ago

Hi When using aws cli or boto to fetch queue attributes there are several missing attributes. Specifically I want to see RedrivePolicy returned but it seems that many other attributes are missing from the response. Expected https://docs.aws.amazon.com/cli/latest/reference/sqs/get-queue-attributes.html

Opalo commented 5 years ago

Hi @FreifeldRoyi!

I've investigated the case and it seems that RedrivePolicy isn't among the attributes that can have some reasonable default value. If you set this attribute explicitly it will be returned properly. Please follow the steps below.

  1. Start elasticmq
  2. Create two queues:
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 create-queue --queue-name lol
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 create-queue --queue-name lol2
  3. Get attributes of the queues:
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 get-queue-attributes --queue-url http://localhost:9324/queue/lol --attribute-names All
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 get-queue-attributes --queue-url http://localhost:9324/queue/lol2 --attribute-names All
  4. Set RedrivePolicy for the second queue:
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 set-queue-attributes --queue-url http://localhost:9324/queue/lol2  --attributes file://attrs.json

    where attrs.json is as follows:

    {"RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:us-central-1:1234WHATEVER:lol\",\"maxReceiveCount\":\"1000\"}"}
  5. Get attributes of the queues:
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 get-queue-attributes --queue-url http://localhost:9324/queue/lol --attribute-names All
    aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 get-queue-attributes --queue-url http://localhost:9324/queue/lol2 --attribute-names All

    RedrivePolicy should be returned for the second queue.

When it comes to the other attributes, please let me know if any is missing, previously verifying if it isn't required to be set after creation of the queue.