Skip to content

Why put SNS before two SQS queues instead of letting both workers share one queue?

1 min read · main part only; folded sections are optional

After this you can answer: Why put SNS before two SQS queues instead of letting both workers share one queue?

The API publishes one versioned booking event. The infrastructure subscribes the email queue and tickets queue to the topic. Each queue has a resource policy allowing SNS to send from this exact topic and account. The workers have separate queue-reading permissions and separate failure queues.

This isolates a slow or broken email path from ticket generation. Queue retention still bounds the outage the system can absorb; buffering is not infinite storage. Consumers also validate their message contracts because persisted events may outlive a deployment.

The topic output waits for both subscriptions to exist before the publisher configuration uses it. That avoids starting a publisher with no routes during normal provisioning. It does not prove that a later policy change or subscription deletion cannot break delivery. Production verification should follow a known booking across both paths, not stop at the SNS acceptance log.

What if raw delivery is switched off?
The SQS body becomes an SNS envelope rather than the booking object expected by the handlers. Schema validation fails until the delivery format or consumer is corrected.
Why not call both queues from the API?
That creates two independent publish outcomes in the request path or relay. SNS centralizes fan-out, though its subscription delivery still needs policies, observability and recovery planning.
How do you find one missing consumer?
Compare the topic subscriptions and each queue policy, then queue age, delivery failures and worker logs. A healthy ticket path cannot prove the email subscription is healthy.

Read Sns fan out, then inspect the booking-events-topic piece →.

infra/src/jobs/booking-events.ts → createBookingEvents

See the SNS delivers nothing case.

Read this book online: https://book.theversehub.in/