Using AWS SNS and SQS in Python

Source: Internet
Author: User

First, SNS = simple Notification Service,sqs = simple Queue Service

What is the difference between SNS and SQS?

(REF:HTTPS://STACKOVERFLOW.COM/QUESTIONS/13681213/WHAT-IS-THE-DIFFERENCE-BETWEEN-AMAZON-SNS-AND-AMAZON-SQS)

SNS is a distributed publish-subscribe system, and once publisher publishes it, subscriber can receive it immediately .

The SNS Subscriber (end point) can be mail, SMS, or even SQS, typically used in cases where the number of subscriber is unknown

SQS is a distributed queue system, and message is not pushed to Subscriber by default.

Subscriber gets a message that needs to be polled (polling).

Once a subscriber receives, processes, or deletes this message, the other Subscribers will not receive the same message.

How to use SNS? (ref:https://gist.github.com/stuartmyles/8099723)

Make sure that the goal of Publisher and Subscriber is the same topic when you ensure that AWS keys are aligned correctly

How do I use SQS? (ref:https://aws.amazon.com/cn/blogs/developer/using-python-and-amazon-sqs-fifo-queues-to-preserve-message-sequencing/)

Use SQS to create (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ sqs-getting-started.html), you need to ensure that AWS Key is exactly the same as the sender key, andQueueName is consistent

You can also let SNS act as publisher and receive it with SQS. In this case, you need to use the set_attributes method (ref:https://aws.amazon.com/cn/blogs/developer/ subscribing-an-sqs-queue-to-an-sns-topic/, https://docs.aws.amazon.com/sns/latest/dg/SendMessageToSQS.html)

Using AWS SNS and SQS in Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.