Routing messages from Amazon SNS to SQS with filtering

后端 未结 2 855
南笙
南笙 2021-02-07 11:03

In RabbitMQ, one can create an exchange, then bind it to multiple queues, each with a routing key. This enables messaging architectures like this:

           mes         


        
2条回答
  •  情深已故
    2021-02-07 11:18

    This is possible by using message attribute filtering in SNS. After you subscribe different SQS queues to an SNS topic, you can specify attributes to filter on by using the SNS API SetSubscriptionAttributes. This will allow messages with different attributes to get routed to the correct SQS queue.

    This is also not limited to SQS queues but any subscription sources on a SNS topic. For example, a single SNS topic can publishing one set of messages to Lambda, and another set to SQS.

    SDK Reference: http://docs.aws.amazon.com/sns/latest/api/API_SetSubscriptionAttributes.html

    More details are given here with examples: https://aws.amazon.com/blogs/compute/simplify-pubsub-messaging-with-amazon-sns-message-filtering/

提交回复
热议问题