Advanced Filter Test Scenarios

With the queue setup completed and the filter policy attached, in this section you will execute 3 test scenarios directly on The Cozy Brew web application and observe the results in the Amazon SQS Console to validate multi-attribute AND matching logic:

  • Scenario A: Matching drink name, but insufficient required quantity -> Filtered out.
  • Scenario B: Sufficient required quantity, but incorrect drink name -> Filtered out.
  • Scenario C: Matching drink name prefix AND sufficient quantity -> Successfully delivered!

Test Scenario A: Matching Drink, Insufficient Quantity (Fails Filter)

  1. Open The Cozy Brew website.
  2. Select Citrus Peach Cold Brew.
  3. Set Cup Size: M (350ml) and Quantity: 1.
  4. Click Place Order & Publish Event.

Test Scenario A: Quantity 1

Test Scenario A: Quantity 1

  1. Check the results in the SQS Console:
    • BaristaQueue: Receives the message (due to having no filter).
    • ColdBrewExpressQueue: Remains at 0 (since it did not meet the quantity >= 2 condition).

Test Scenario A Result


Test Scenario B: Sufficient Quantity, Non-Matching Drink (Fails Filter)

  1. Return to The Cozy Brew website.
  2. Select Caramel Macchiato (does not have the "Citrus" prefix).
  3. Set quantity to Quantity: 3 (satisfies quantity condition >= 2).
  4. Click Place Order & Publish Event.

Test Scenario B: Non-matching Drink

  1. Check the SQS Console:
    • BaristaQueue: Receives the message.
    • ColdBrewExpressQueue: Remains at 0 (since it did not meet the "Citrus" drink name prefix).

Test Scenario B Result


Test Scenario C: Both Conditions Satisfied (Delivered!)

  1. Return to The Cozy Brew website.
  2. Select Citrus Peach Cold Brew (matches the "Citrus" prefix).
  3. Set quantity to Quantity: 2 (satisfies quantity >= 2).
  4. Click Place Order & Publish Event.

Test Scenario C: Both Conditions Met

  1. In the SQS Console, inspect the ColdBrewExpressQueue queue:
    • The Messages available column has now jumped to 1!
    • Click on the queue, click Send and receive messages, and click Poll for messages to verify that the 2x Citrus Peach Cold Brew order message arrived successfully.

Message Arrived in ColdBrewExpressQueue

Message Arrived in ColdBrewExpressQueue

Message Arrived in ColdBrewExpressQueue

Message Arrived in ColdBrewExpressQueue


Summary of Chapter 5

You have mastered the Advanced Message Filtering technique:

  • Flexibly combined string prefix matching ({"prefix": "Citrus"}) and numeric comparison operators ({"numeric": [">=", 2]}).
  • Verified the powerful multi-attribute boolean AND evaluation mechanism of SNS.
  • Built an intelligent message routing fabric without having to write any complex routing code in the backend.