navigation

Working with SNS

We will implement an API integration model using Fan-out and message filtering.

As a registered customer, when you need a ride, you can use the Wild Rydes customer app to request a unicorn and manage your ride. As a registered unicorn, you can use the Wild Rydes unicorn app to manage everything around your business.

In particular, unicorns want to use the app to notify ride completion after they have successfully taken a customer to their destination. This is the use case that we will take a closer look at.

At Wild Rydes, end-user customers typically communicate via REST APIs with backend services. For our use case, the Wild Rydes unicorn app interacts with the API provided by the unicorn management service. It uses the ride completion notification resource to send relevant details of the ride to the backend. In response to that, the backend service creates a new resource for the completed ride and returns the corresponding status code, location, and representation of the new resource to the client.

Perhaps not surprisingly, there are other services in the Wild Rydes microservices landscape that are also interested in a newly completed ride:

  • Customer notification service: Customers will receive a notification in their app about their most recently completed ride.
  • Customer accounting service: After all, Wild Rydes is a business, so this service will be responsible for collecting the fare from the customer.
  • Extraordinary rides service: This service is specifically interested in rides with a fare or distance above a certain threshold - preparing the corresponding data for marketers and success managers.
  • This use case is clearly suited for a publish/subscribe messaging model, which can be easily implemented using Amazon SNS in a serverless and scalable way. It minimizes interdependency between both sides. The services on the right side can autonomously subscribe to topics on the left side.

Working with SNS

This workshop will continue the story of the workshop Build a serverless web app Wild Rydes

Contents

  1. Introduce
  2. Prerequisites
  3. Initialize State using SAM
  4. Create Amazon SNS Topic
  5. Create Customer notification service
  6. Create Customer accounting service
  7. Create Extraordinary rides service
  8. Update Unicorn Management Service
  9. Test Fan-out and message filtering
  10. Resource Cleanup