Skip to content

Provide a way to access Message Attributes in SnsMessage/SnsNotification #2716

Closed
@GouthamiKondakindi

Description

@GouthamiKondakindi

Describe the feature

Setup: A queue in SQS is subscribed to a topic in SNS with RawMessageDelivery=false

Usecase: When a message is published to the above topic and this message has some message attributes, when this message is forwarded to a queue, the message body that SQS receives will be in JSON format and this JSON contains "MessageAttributes".
Sample message that SQS receives in this case:
{
"Type": "Notification",
"MessageId": "dc1e94d9-56c5-5e96-808d-cc7f68faa162",
"TopicArn": "arn:aws:sns:us-east-2:111122223333:ExampleTopic1",
"Subject": "TestSubject",
"Message": "This is a test message.",
"MessageAttributes": {
"<Attribute 1>": {
"Type": "String",
"Value": "<Attribute 1 Value>"
},
"<Attribute 2>": {
"Type": "String"
"Value": "<Attribute 2 Value>"
}
}
"Timestamp": "2021-02-16T21:41:19.978Z",
"SignatureVersion": "1",
"Signature": "abc==",
"SigningCertURL": "<cert.pem>",
"UnsubscribeURL": ""
}

But I don't see this "MessageAttributes" in SnsNotification.java or SnsMessage.java. So, I don't have a way to map the message body that SQS receives to a Java object in the aws sdk.

Is your Feature Request related to a problem?

AWS sdk provides no way to parse the message that SQS received from SNS and extract "MessageAttributes" from it.

Proposed Solution

Add "MessageAttributes" to SnsNotification.java or SnsMessage.java

Describe alternatives you've considered

Alternative would be to create my own custom object to map the JSON and extract "MessageAttributes" from it.

Acknowledge

  • I may be able to implement this feature request

AWS Java SDK version used

1.12.167

JDK version used

1.8.0_172

Operating System and version

macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will close in 2 days unless further comments are made.duplicateThis issue is a duplicate.feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions