Search code examples
amazon-web-servicesamazon-sqsaws-sqs-fifo

AWS SQS FIFO event messageAttributes example?


For AWS SQS FIFO queues, on AWS official documentation, I could not find any clear examples for the format of the messageAttributes object (which is a sub-object within the event object, aka the queue message event object).

Can anyone provide an example of the full SQS FIFO queue message event object? Thank you.


Solution

  • Example of SQS FIFO event object (in particular, the messsageAttributes object):

    {
        "Records": [
            {
                "messageId": "11d6ee51-4cc7-4302-9e22-7cd8afdaadf5",
                "receiptHandle": "AQEBBX8nesZEXmkhsmZeyIE8iQAMig7qw...",
                "body": "Test message.",
                "attributes": {
                    "ApproximateReceiveCount": "1",
                    "SentTimestamp": "1573251510774",
                    "SequenceNumber": "18849496460467696128",
                    "MessageGroupId": "1",
                    "SenderId": "AIDAIO23YVJENQZJOL4VO",
                    "MessageDeduplicationId": "1",
                    "ApproximateFirstReceiveTimestamp": "1573251510774"
                },
                "messageAttributes": {
                    'myKey': {
                        'stringValue': 'myStringValue', 
                        'stringListValues': [], 
                        'binaryListValues': [], 
                        'dataType': 'String'
                    }
                },
                "md5OfBody": "e4e68fb7bd0e697a0ae8f1bb342846b3",
                "eventSource": "aws:sqs",
                "eventSourceARN": "arn:aws:sqs:us-east-2:123456789012:fifo.fifo",
                "awsRegion": "us-east-2"
            }
        ]
    }
    

    This Q&A post is to provide an example output of the event object, to supplement the official documentation. I will also be making a pull request about this in due time.