What is the difference between "MessageAttributeName.N" and "AttributeName.N" in SQS ReceiveMessage

Viewed 3011

The SQS "ReceiveMessage" endpoint has two params that seem to do the same thing and I don't understand the API docs. Can someone explain the difference:

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html

AttributeName.N
A list of attributes that need to be returned along with each message
MessageAttributeName.N
The name of the message attribute, where N is the index.
...
When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying All

It seems that they both do the same thing, i.e. specifying which attributes should be returned on fetched messages. Is there any difference? If not, which is preferred?

1 Answers

I see now:

AttributeName returns AWS's attributes like "ApproximateFirstReceiveTimestamp"

MessageAttributeName returns message (user specified) attributes

Related