Skip to content

Latest commit

 

History

History
45 lines (44 loc) · 2.02 KB

10.1.2. Integrations - Queues - SNS.md

File metadata and controls

45 lines (44 loc) · 2.02 KB

Amazon SNS (Simple Notification Service)

  • SNS has pub/sub model
  • Event producer only sends message to one topic
  • As many event receivers (subscriptions) as we want to listen
  • Different from SQS where you have direct integration between listeners & senders.
  • Retention: ❗ You have to process the data right away or it's lost
  • Flow
  • Event producer publish messages to a SNS topic
    • ❗ Up to 100.000 topics (soft limit)
  • Subscriptions listen a specific SNS topic
    • ❗ Up to 10.000.000 subscriptions per topic (soft limit)
    • Each subscriber get all the messages but can filter.
  • Subscribers can be
    • SQS
    • HTTP/HTTPS (with delivery retries)
    • Lambda
    • Emails, SMS messages, Mobile Notifications
  • High availability with managed replication to 3 AZ.
  • Pay as you go pricing
  • Integrations: SNS integrates with a lot of Amazon Services
  • Some services can send data directly to SNS for notifications
  • E.g. CloudWatch for alarms, Auto Scaling Groups notifications, Amazon S3 on bucket events CloudFormation (upon state changes => failed to build etc.) ...
  • Publish types
    • Topic Publish (within your AWS server - using the SDK)
      1. Create a topic
      2. Create a subscription (or many)
      3. Publish to the topic
    • Direct Publish (for mobile apps SDK)
      1. Create a platform application
      2. Create a platform endpoint
      3. Publish to the platform endpoint
        • Works with Google GCM, Apple APNS, Amazon ADM
  • 📝Fan out (SNS -> SQS)
    • Push once in SNS, receive in many SQS
      • E.g. *Buying Service -> SNS Topic ->
        1. SQS Queue 1 (-> Fraud service)
        2. SQS Queue 2 (-> Shipping service)
    • Good because:
      • 💡 No data loss (in SNS you need to handle message right away)
      • Ability to add receivers later
      • SQS allows for delayed processing and retries of work
      • May have many workers on one queue and one worker on the other queue
      • In only SQS a message is not guaranteed to be delivered to all consumers
      • Ability to add receivers later