Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
770 stars 145 forks source link

SNS HTTP subscription FilterPolicy don't work #214

Open rcpires opened 4 years ago

rcpires commented 4 years ago

HTTP FilterPolicy option seems not working! A config like that:

Topics:
    - Name: my_topic
      Subscriptions:
        - Protocol: http
          EndPoint: http://backend/my_listener_1
          TopicArn: arn:aws:sns:us-east-1:000000000000:my_topic
          FilterPolicy: '{"event": ["my_event_1"]}'
        - Protocol: http
          EndPoint: http://backend/my_listener_2
          TopicArn: arn:aws:sns:us-east-1:000000000000:my_topic
          FilterPolicy: '{"event": ["other_event", "another_event"]}'

With this config was expected the /my_listener_1 endpoint to receive notifications just from events published with "my_event_1" on message attributes. But all endpoints/subscriptions are receiving notifications for any event published to SNS my_topic (even for events published without MessageAttributes).

Can this be a bug? Or my config is wrong?

Thanks!

maxholman commented 3 years ago

For anyone else finding this issue, I fixed this with a couple of lines of code in app/gosns/gosns.go

See: https://github.com/maxholman/goaws/commit/1e39f6ac00695a66a93c5d9557a09d8df51f5ce1

I have absolutely zero golang experience, so I'll just leave this on my fork for reference.

cc: #215