Skip to content

SQS ReceiveMessageRequest attributeNames() are not Message Attributes #2615

@WillyGitty

Description

@WillyGitty

Describe the bug

In SQS, ReceiveMessageRequest.builder().attributeNames() Enum values does not correspond the the message attributes

https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/sqs/model/ReceiveMessageRequest.html

  • All
  • ApproximateFirstReceiveTimestamp
  • ApproximateReceiveCount
  • AWSTraceHeader
  • SenderId
  • SentTimestamp
  • MessageDeduplicationId
  • MessageGroupId
  • SequenceNumber

Right now the method accepts the QueueAttributeName enum that does not contains those values.

https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/sqs/model/QueueAttributeName.html

Expected Behavior

When trying to receive message with some specific attributes I should be able to specify them using the correct Enum.

Current Behavior

The method attributeNames() should use an Enum with message attributes values (ex: MessageAttributeNames)

Steps to Reproduce

For example, now since the attributeNames is scoped to the wrong enum, we cant get a property like ApproximateReceiveCount

        final ReceiveMessageRequest receiveMessageRequest = ReceiveMessageRequest.builder()
            .queueUrl(queueUrl)
            // I cant call an enum with the ApproximateReceiveCount
            .attributeNames(QueueAttributeName.???) 
            // However this works
            .attributeNamesWithStrings("ApproximateReceiveCount")
            .maxNumberOfMessages(10)
            .waitTimeSeconds(seconds)
            .build();

As you can see .attributeNamesWithStrings("ApproximateReceiveCount") does behave correctly but It is impossible to do the same with the Enum version .attributeNames(???).

Possible Solution

Implement a new enum (ex: MessageAttributeNames)
that coincide with the following properties

  • All
  • ApproximateFirstReceiveTimestamp
  • ApproximateReceiveCountAWSTraceHeader
  • SenderId
  • SentTimestamp
  • MessageDeduplicationId
  • MessageGroupId
  • SequenceNumber

Context

Your Environment

  • AWS Java SDK version used: 2.17.1
  • JDK version used: openjdk 11
  • Operating System and version: Linux with Ubuntu 20.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue is a duplicate.service-apiThis issue is due to a problem in a service API, not the SDK implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions