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)
- Open The Cozy Brew website.
- Select Citrus Peach Cold Brew.
- Set Cup Size: M (350ml) and Quantity:
1.
- Click Place Order & Publish Event.


- 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 B: Sufficient Quantity, Non-Matching Drink (Fails Filter)
- Return to The Cozy Brew website.
- Select Caramel Macchiato (does not have the
"Citrus" prefix).
- Set quantity to Quantity:
3 (satisfies quantity condition >= 2).
- Click Place Order & Publish Event.

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

Test Scenario C: Both Conditions Satisfied (Delivered!)
- Return to The Cozy Brew website.
- Select Citrus Peach Cold Brew (matches the
"Citrus" prefix).
- Set quantity to Quantity:
2 (satisfies quantity >= 2).
- Click Place Order & Publish Event.

- 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.




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.