Example Amazon Event Fork Pipelines use case - Amazon Simple Notification Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Example Amazon Event Fork Pipelines use case

The following scenario describes an event-driven, serverless e-commerce application that uses Amazon Event Fork Pipelines. You can use this example e-commerce application in the Amazon Serverless Application Repository and then deploy it in your Amazon Web Services account using the Amazon Lambda console, where you can test it and examine its source code in GitHub.

This e-commerce application takes orders from buyers through a RESTful API hosted by API Gateway and backed by the Amazon Lambda function CheckoutApiBackendFunction. This function publishes all received orders to an Amazon SNS topic named CheckoutEventsTopic which, in turn, fans out the orders to four different pipelines.

The first pipeline is the regular checkout-processing pipeline designed and implemented by the owner of the e-commerce application. This pipeline has the Amazon SQS queue CheckoutQueue that buffers all received orders, an Amazon Lambda function named CheckoutFunction that polls the queue to process these orders, and the DynamoDB table CheckoutTable that securely saves all placed orders.

Applying Amazon Event Fork Pipelines

The components of the e-commerce application handle the core business logic. However, the e-commerce application owner also needs to address the following:

  • Compliance—secure, compressed backups encrypted at rest and sanitization of sensitive information

  • Resiliency—replay of most recent orders in case of the disruption of the fulfillment process

  • Searchability—running analytics and generating metrics on placed orders

Instead of implementing this event processing logic, the application owner can subscribe Amazon Event Fork Pipelines to the CheckoutEventsTopic Amazon SNS topic

The following JSON filter policy is set in the configuration for the Event Search and Analytics Pipeline. It matches only incoming orders in which the total amount is $100 or higher. For more information, see Amazon SNS message filtering.

{ "amount": [{ "numeric": [ ">=", 100 ] }] }

Using the Amazon Event Fork Pipelines pattern, the e-commerce application owner can avoid the development overhead that often follows coding undifferentiating logic for event handling. Instead, she can deploy Amazon Event Fork Pipelines directly from the Amazon Serverless Application Repository into her Amazon Web Services account.