Inspect SQS Queues & Clean Up

In this section, you will verify the second distribution branch of the Fan-Out pattern: the Amazon SQS (BaristaQueue). You will poll for messages, inspect the message content (Body) and metadata attributes (Message Attributes). Additionally, you will verify that the VIPExpressQueue received zero messages thanks to SNS attribute-based filtering, before cleaning up the queue in preparation for the next hands-on lab.


Verify Messages in Amazon SQS (BaristaQueue)

  1. In the AWS Management Console search bar, type SQS and select Simple Queue Service.
  2. In the Queues list, observe the row for BaristaQueue. You will notice that the Messages available column has incremented to the number of times you published an event (if you published once, the value will be = 1).

BaristaQueue Messages Available

  1. In the upper right corner of the screen, click the Send and receive messages button.

Click Send and receive messages

  1. In the Receive messages section, scroll down and click the Poll for messages button.

Click Poll for messages

  1. Amazon SQS scans the queue and displays the newly received message row with its Message ID, Sent timestamp, Size, and Receive count.

Poll Result Row

  1. Click on the Message ID to open the message details dialog:
    • Body tab: Contains the full order receipt payload generated by the Lambda function.
    • Attributes tab: Contains the metadata attributes (Message Attributes) attached by Lambda during sns:Publish:
      • drink: String (Vietnamese Iced Latte)
      • size: String (M)
      • quantity: Number (1)
      • is_vip: String (false)

Inspect Message Body

  • Body Tab

Inspect Message Attributes

  • Attributes Tab

Inspect Message Attributes


Verify that VIPExpressQueue Did NOT Receive the Message

  1. Click the Queues navigation breadcrumb in the top-left to return to the full Queues list.
  2. Observe the row for the VIPExpressQueue.
  3. The Messages available column remains at 0.

VIPExpressQueue Empty

VIPExpressQueue Empty

Why was the message not delivered to VIPExpressQueue?
The VIPExpressQueue subscription is configured with a filter policy: quantity >= 5. Because our order had a quantity of quantity = 1, Amazon SNS automatically evaluated the message attributes and suppressed delivery to this queue. This optimizes compute resources, avoiding unnecessary processing overhead for VIP worker processes!


Clean Up Messages from the Queue

  1. Select the BaristaQueue Queue and click the Purge button on the details page to clear all test messages.

Purge SQS Messages

  1. Click the confirmation button to proceed. The queue is now completely clean and ready for the next exercise.

Confirm Purge


Summary of Chapter 3

Through the exercises above, you have successfully verified the Fan-Out messaging pattern:

  • A single order event published to SNS was cloned and distributed concurrently to both Email and BaristaQueue.
  • Downstream consumers processed messages completely independently without coupling.
  • The VIPExpressQueue was intelligently bypassed thanks to Amazon SNS attribute-based filter policies.