Skip to content

Why it verifies and never creates

The adapter holds an at-least-once subscription to a queue the operator made, and refuses with a message naming what it found when the queue is not what it needs. It never declares an exchange, or a queue for an at-least-once subscription.

A bus binds, and a queue is the operator's

An at-least-once subscription's identity is a queue with a backlog, a binding and a dead-letter route. The core's rule, which the adapter's errors quote, is that a bus binds to an exchange and never creates one, and resolves a queue and never creates one (spec 0005 D9, 0009 D2). Where an operator wants the queue made on first use, Settings.Topology is the place: their tool can create on resolve, and the adapter still verifies what comes back.

So Open passively declares the exchange and fails with ErrNoExchange if it is absent, and Subscribe passively declares the queue and fails with ErrNoQueue.

Why the management API

AMQP 0-9-1 cannot say what kind of queue a queue is, what its effective delivery limit is, or what it is bound to. The adapter's checks are claims about those, and a claim made from the wire alone would be a guess. So the management API is a dependency, not a hedge: Open fails with ErrManagement if it does not answer, naming the path.

What it asks of the API, and nothing else:

  • the queue document: type, arguments, effective_policy_definition and delivery_limit;
  • the queue's bindings.

For the dead-letter and consumer-timeout settings the adapter takes the queue argument first and the effective policy second, so either way of configuring them works.

The queue document's statistics fields appear only after the API's statistics interval. The adapter therefore retries the queue read, every 500 ms for up to 15 seconds, until delivery_limit is present. A queue created a moment ago can take that long to be verifiable.

Why it refuses rather than corrects

Each check guards a promise the adapter makes:

  • A quorum queue is what makes "survives a restart" true.
  • A dead-letter exchange with the at-least-once strategy and reject-publish overflow is what makes "lands in the dead-letter queue" a promise. The quorum default can lose a dead-lettered message, and reject-publish is what at-least-once dead-lettering requires.
  • A delivery limit of at least MaxDeliver - 1 means the broker never dead-letters before the adapter's last attempt. The broker counts failed deliveries and the adapter counts attempts.
  • A binding that matches the subscription's pattern means the pattern is the queue's identity. A different pattern on reopen is a different identity, and the core's contract is that a durable identity is immutable, naming the field.
  • A consumer timeout a minute clear of MaxProcessingTime means the broker does not cancel the consumer mid-handler.

Fixing any of them silently would change a queue under its other consumers. The error says what to change; the operator changes it.

What it does create

An AtMostOnce subscription has no identity to keep, so it declares its own transient queue. See Topology it expects.