This section demonstrates the extensibility of event driven architectures. New functional requirements come up all the time in production applications. We can address new requirements for an event driven application by creating new rules for events in the Event Bus. These rules can add new functionality to the application without having any impact to the existing application stack.
This section shows how to route all order completed events from the OrderManager workflow to an SQS queue. A Lambda function will process the events in batches off of the queue and insert business metrics into Cloudwatch. The new rule enables business metric collection for events in your event bus.
Using SQS as a target for EventBridge events reduces pressure on your downstream systems from spikes in traffic in the event bus.
WaitingCompletion
Lambda function emits an OrderManager.WaitingCompletion
event to the Event Bus as the barista makes the order. We can use the OrderManager.WaitingCompletion
event to update serverlesspresso-metrics-table
.OrderManager.OrderCancelled
events to track how many orders are completed or cancelled over time.OrderManager.WaitingCompletion
events and route them to an SQS Queue. The events are processed in batches off the queue by a Lambda function that updates metrics in Cloudwatch, where they can be viewed using a Cloudwatch Dashboard.This section has its own CloudFormation template that is separate from the core stack. You’ll need to follow the steps below to deploy the resources required for this module.
By executing these templates, you are taking responsibility for the lifecycle and costs associated with provisioning them. Please follow the tear-down instructions to remove all resources from your AWS account once you have finished the workshop to avoid incurring unexpected costs.
We will leverage AWS CloudFormation which allows us to codify our infrastructure. Select your preferred region to which you will deploy the template. Just click the Launch link to create the stack in your account.
Region | Launch stack |
---|---|
US East (N. Virginia) us-east-1 | Launch |