In the pub/sub model, when an event is published, a notification is sent to all subscribers, and each subscriber can take the necessary action as per their requirements of data processing. Let's take an example of a photo studio application, which enriches a photo with different filters and sends a notification to the user. The following architecture depicts a pub/sub model:
Photo studio application pub/sub-event-driven architecture
In the preceding diagram, you will notice the following things:
- The user first uploads the picture to an Amazon S3 bucket using a web/mobile application.
- The Amazon S3 bucket then sends a notification to Amazon Simple Notification Service (SNS). Amazon SNS is a message topic with the following subscribers:
- Here, the first subscriber is using the email service, and as soon as the photo upload is complete, an email is sent to the user.
- The second subscriber is using Amazon SQS queue, which gets the message from the Amazon...