Development with AWS Services

An SNS topic fans out order events to two SQS queues. Billing must receive every event, but fulfillment needs only events whose orderType message attribute is physical. How should the team keep other events out of the fulfillment queue without changing the publisher?

Show the answer

Correct answerD. Add a filter policy to the fulfillment queue's subscription that matches orderType physical.

AWhy not this: A visibility timeout only hides received messages temporarily; every message is still delivered to the queue.

BWhy not this: A dead-letter queue receives messages that fail processing too many times, not messages of a given type.

CWhy not this: Raw message delivery removes the SNS JSON envelope but still delivers every message.

DWhy this is right: A subscription filter policy lets SNS deliver only matching messages to that subscription.

An SNS subscription filter policy makes SNS deliver to that subscription only messages whose attributes (or body) match, so the fulfillment queue receives only physical orders while billing's unfiltered subscription receives everything. Visibility timeouts, dead-letter queues and raw message delivery change how messages are processed or formatted, not which messages are delivered.