Is there a way to implement producer/consumer messaging model in AWS where consumers are selective?
Consider a baggage carousel. Producer puts bags on a carousel and consumers pick up bags when they believe that they are theirs. Producer and the carousel itself don't know which bag belongs to whom. It's a consumer responsibility to pull the correct bag. Carousel personnel responsible only for removing unclaimed bags from the carousel and stowing them for further processing.
Can we have a message system in which multiple consumers are pulling the message in a self-service manner?
- SQS does not allow consumers to be selective (having several picky consumers would all but guarantee that the message would go DLQ before reaching the intended one).
- SNS and EventBridge require message filtering logic to be implemented/reproduced on server side, which means no "self service" for the consumers.
This messaging system, as a minimum, should allow sufficient time for all consumers to try to pull messages, and ideally, keep track if all consumers had actually checked the message before putting it to DLQ.
This messaging system should never let the message be consumed by more than one consumer.
AWS SQS Selective Polling Pattern
Can we filter messages from Amazon SQS queue by message attributes?