Skip to content

Why it binds and never creates

Topics, queues, subscriptions and redrive policies are the operator's. The adapter resolves them at Subscribe and Publish and fails naming whichever is missing: sqs.ErrNoTopic or sqs.ErrNoQueue. This follows the core's rule that a bus binds, and never creates.

What the adapter takes from the queue it binds to, instead of choosing it:

  • The retry budget. SQS counts receives and moves a message to the dead-letter queue itself, so the redrive policy is where the budget is enforced. The adapter reads the policy at Subscribe, and the subscription's MaxDeliver must equal its maxReceiveCount. Two budgets for one message could not be compared, which is why there is one. See How a message is settled.
  • The lease. With AckWait zero, the adapter takes the queue's VisibilityTimeout as the lease.

The one exception

An AtMostOnce fan-out subscription gets a queue of its own. It is created at Subscribe, named ephemeral- plus 16 hex digits (and .fifo), subscribed raw to the subject's topic, and given an access policy admitting that topic and nothing else. It is unsubscribed and deleted at Retire.

It is created because each process fanning out needs its own copy, and a per-process queue is not something an operator can name ahead of time: the queue exists only for the life of one source.

Two consequences follow, and neither is hidden by the module:

  • the queue holds one of the topic's subscriptions while it lives, which counts toward the cap in Limits;
  • if the process dies before Retire, nothing in the adapter removes the queue or its subscription. This is read from the source, which deletes only on retirement and on a failed Subscribe.

What binding does not check

The adapter does not check that a queue is subscribed to the topic, that the subscription is raw, or that the dead-letter queue named in the redrive policy exists. Those are yours; the first two show up as a queue that receives nothing and as unreadable messages.