ld.← ALL FIELD NOTESSELECTED WORK ↗
FIELD NOTES / 19AWS ARCHITECTURE   ·   DISTRIBUTED SYSTEMS

Why put a queue between SNS and Lambda?

SNS can invoke Lambda directly. We added SQS because each consumer needed its own buffer and processing pace.

A queue for each consumer

A graph change is published to SNS and delivered to separate SQS queues for search, vector, and document consumers. Lambda polls each queue and handles its messages. A backlog in one queue does not have to stop the others.

SQS gives each consumer a configurable queue, visibility timeout, and redrive policy. Failed messages can be retried and, after the configured receive threshold, moved to a dead-letter queue for investigation.

The hard part is the behavior around it

SNS-to-Lambda delivery is not simply fire-and-forget: AWS provides retry and failure-handling mechanisms for asynchronous invocation. SQS adds an explicit per-consumer buffer and queue controls that fit our workflow.

The more difficult problem was handling events for the same knowledge graph when they arrive or execute out of order. That needs careful concurrency, retry, and ordering design beyond the fan-out diagram.

Continue the conversation

Further reading

KEEP READING / 18One graph change, many consumers.

Another note from the notebook.