Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping MessageAttributes using SNS #128

Open
bryce-palmer opened this issue Apr 17, 2021 · 0 comments
Open

Mapping MessageAttributes using SNS #128

bryce-palmer opened this issue Apr 17, 2021 · 0 comments

Comments

@bryce-palmer
Copy link

bryce-palmer commented Apr 17, 2021

We are attempting to publish messages to SNS via this API Gateway proxy plugin, but are running into issues mapping MessageAttributes, which is stopping us from filtering.

We are currently posting messages with a JSON body l like this:


{
  "Type":"Notification",
  "Message":{
     "entity_type":"node",
     "bundle":"article",
     "id":"20656",
     "uuid":"234653463463",
     "label":"How to be \u201cgreen\u201d at home",
     "langcode":"en",
     "isDefaultLanguage":true,
     "destinationURL":"https:\/\/google.com\/test",
     "source":"Source Here",
     "campaignId":"How to be \u201cgreen\u201d at home",
     "shortTitle":"How to be \u201cgreen\u201d at home",
     "audience":[
        "1018",
        "1019",
        "1020"
     ],
     "segment":[
        "4621"
     ],
     "jsonAPIRoute":"\/jsonapi\/node\/article\/057802183",
     "title":"How to be \u201cgreen\u201d at home",
     "status":false,
     "promote":false,
     "sticky":false,
     "path":{
        "alias":"\/test\/about-liberty\/test\/test\/how-to-be-green-at-home",
        "pid":"64871",
        "langcode":"en"
     },
     "publishedDate":"2038-01-19T03:14:07+0000"
  },
  "MessageAttributes":{
     "op":"UPDATE",
     "entity_type":"node",
     "bundle":"article"
  }
}

And this is all being injected into the Message field.

This then leads to the SNS message logging like this:

{
  Records: [
    {
      EventSource: 'aws:sns',
      EventVersion: '1.0',
      EventSubscriptionArn:
      'arn:aws:sns:us-east-1:23454324532:node-article-topic:2345432532',
      Sns: {
      Type: 'Notification',
      MessageId: '345243562',
      TopicArn: 'arn:aws:sns:us-east-1:32453253425:node-article-topic',
      Subject: null,
      Message: 'ABOVE JSON HERE IN FULL'
      MessageAttributes: {}
    }
  ]
}

We have experimented with requestParameters but have not yet been successful to map the message to the message and attributes accordingly for filtering. Is this not possible with SNS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant