DVA-C03 practice question: Caching and message filtering
Troubleshooting and Optimization A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.
A payments team publishes order events to an SNS topic.
Each message sets two String message attributes, region and status, and may also have a JSON body that repeats them. A shipping queue subscribes to the topic with its filter policy scope set to MessageAttributes, and the policy is {"region": ["eu-west-2"], "status": [{"prefix": "SHIPPED_"}]}.
Which published message is delivered to the shipping queue?
Choose one answer.
AA. The region attribute is eu-west-2, and the status attribute is SHIPPED_FULL.
BB. The region attribute is eu-west-2, and the status attribute is PENDING_SHIPMENT.
CC. The region attribute is eu-west-1, and the status attribute is SHIPPED_FULL.
DD. It has no message attributes, and its body has region eu-west-2 and status SHIPPED_FULL.
B. Wrong: The status value does not start with SHIPPED_, so the prefix match fails and the message is not delivered.
C. Wrong: eu-west-1 is not in the region list, so that key fails. Every key in the policy must match, so the status match is not enough.
D. Wrong: The scope is MessageAttributes, so SNS checks attributes and ignores the body. With no attributes, neither key matches, and the message is not delivered.
Explanation
With MessageAttributes scope, each key in a filter policy must match a message attribute of that name. Within one key, any listed value or prefix may match, but every key must match. Prefix matching applies to string values, and the body is not checked in this scope.
Want more on Caching and message filtering? The 5 full-length practice sets have 6 more Caching and message filtering questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →