Skip to content

maxReceiveCount is returned as a string #1785

@dvergnes

Description

@dvergnes

maxReceiveCount is not always converted to an integer when reading the attributes. If the redrivePolicy is set using set-attributes after the queue is created then maxReceiveCount is returned as a string. However, if the redrivePolicy is set during queue creation (i.e. using create-queue then maxReceiveCount is returned as an integer as expected.

Step to reproduce:

  • create a queue foo
    awslocal sqs create-queue --queue-name foo
  • create a DLQ foo-DLQ
    awslocal sqs create-queue --queue-name foo-DLQ
  • create an foo-attributes.json with following content
    { "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:elasticmq:000000000000:foo-DLQ\",\"maxReceiveCount\":\"10\"}" }
  • update queue foo attributes
    awslocal sqs set-queue-attributes --queue-url http://localhost:4576/queue/foo --attributes file://foo-attributes.json
  • get queue foo attributes
    awslocal sqs get-queue-attributes --queue-url http://localhost:4576/queue/foo --attribute-names All

Current result:
maxReceiveCount is returned as a string

{
    "Attributes": {
        "ApproximateNumberOfMessagesNotVisible": "0",
        "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:elasticmq:000000000000:foo-DLQ\",\"maxReceiveCount\":\"10\"}",
        "MessageRetentionPeriod": "259200",
        "ApproximateNumberOfMessagesDelayed": "0",
        "MaximumMessageSize": "131072",
        "CreatedTimestamp": "1574356609",
        "ApproximateNumberOfMessages": "0",
        "ReceiveMessageWaitTimeSeconds": "0",
        "DelaySeconds": "0",
        "VisibilityTimeout": "30",
        "LastModifiedTimestamp": "1574356609",
        "QueueArn": "arn:aws:sqs:us-east-1:000000000000:foo"
    }
}

Expected behavior:
maxReceiveCount is returned as an integer

{
    "Attributes": {
        "ApproximateNumberOfMessagesNotVisible": "0",
        "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:elasticmq:000000000000:foo-DLQ\",\"maxReceiveCount\":10}",
        "MessageRetentionPeriod": "259200",
        "ApproximateNumberOfMessagesDelayed": "0",
        "MaximumMessageSize": "131072",
        "CreatedTimestamp": "1574356609",
        "ApproximateNumberOfMessages": "0",
        "ReceiveMessageWaitTimeSeconds": "0",
        "DelaySeconds": "0",
        "VisibilityTimeout": "30",
        "LastModifiedTimestamp": "1574356609",
        "QueueArn": "arn:aws:sqs:us-east-1:000000000000:foo"
        }
}

Versions:

  • affected: 0.10.3, 0.10.4, 0.10.5
  • non affected: 0.9.0, 0.10.0, 0.10.2

Metadata

Metadata

Assignees

Labels

good first issueGood item to work on for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions