Publish/subscribe messaging, or pub/sub messaging, is a form of asynchronous service-to-service communication used in serverless and microservices architectures. In a pub/sub model, any message published to a topic is immediately received by all of the subscribers to the topic. Pub/sub messaging can be used to enable event-driven architectures, or to decouple applications in order to increase performance, reliability and scalability.

Below are several resources to help you better understand Pub/Sub in the broad sense. If you’d instead like to learn more about Pub/Sub messaging on AWS, read our blog, Building Scalable Applications and Microservices: Adding Messaging to Your Toolbox, for an overview of Amazon Simple Notification Service (SNS).

33:27
Watch our Webinar to Understand the Role and Components of Messaging in Application Design
Decouple and Scale Applications Using Amazon SQS and Amazon SNS Small startups to the biggest global enterprises are designing applications using microservices and distributed architecture to improve resiliency and scale faster. AWS messaging services – Amazon Simple Queue Service (SQS) and Amazon Simple Notification Service (SNS) – make it easy to decouple communication between software components and build modern applications that are fault-tolerant and easy to scale. Messaging is a key part of Amazon’s own e-commerce platform architecture, and used in mission-critical backend systems such as Amazon Retail Ordering workflow. In this session, we will show how you can use Amazon SQS and Amazon SNS fully managed messaging to decouple your application architecture, enable asynchronous communication between different services, and eliminate the pain associated with operating dedicated messaging software and infrastructure. We will demonstrate common messaging design patterns for building reliable and scalable applications in the cloud. Learning Objectives: - Understand key messaging use cases, including service-to-service communication, asynchronous work item backlog, and state change notifications - Learn how to get started using message queues and topics with just a few simple APIs, and quickly integrate with other AWS services - Hear how customers, like Capital One, are benefiting from migrating applications to a fully managed messaging solution in the cloud

In modern cloud architecture, applications are decoupled into smaller, independent building blocks that are easier to develop, deploy and maintain. Publish/Subscribe (Pub/Sub) messaging provides instant event notifications for these distributed applications.  

The Publish Subscribe model allows messages to be broadcast to different parts of a system asynchronously. A sibling to a message queue, a message topic provides a lightweight mechanism to broadcast asynchronous event notifications, and endpoints that allow software components to connect to the topic in order to send and receive those messages. To broadcast a message, a component called a publisher simply pushes a message to the topic. Unlike message queues, which batch messages until they are retrieved, message topics transfer messages with no or very little queuing, and push them out immediately to all subscribers. All components that subscribe to the topic will receive every message that is broadcast, unless a message filtering policy is set by the subscriber.

pub/sub model

The subscribers to the message topic often perform different functions, and can each do something different with the message in parallel. The publisher doesn’t need to know who is using the information that it is broadcasting, and the subscribers don’t need to know who the message comes from. This style of messaging is a bit different than message queues, where the component that sends the message often knows the destination it is sending to. For more information on message queuing, see “What is a Message Queue?

Get started with Amazon Simple Notification Service (SNS) for free with just three simple commands.