Status: accepted Date: 2026-09-24 Deciders: GoBridge core Amends: 0017 (its redrive-batch consequence: each entry of an admin redrive batch now has its own bound) Relates to: 0015 (every rule of an admin redrive also holds for an automatic one), 0003 (the removed-subscription dead-letter this redrives)
Some dead-letter records wait only for a condition the bridge can see for
itself. The first case comes from the ADR 0003 addendum. When a configuration
change removes a filter from a persistent or exclusive MQTT session, the broker
can still hand the session deliveries for that filter. With a dead-letter store,
the session writes each one to the store with error code SUBSCRIPTION_REMOVED
and acknowledges it. A filter is often removed by mistake, or as one step of a
staged migration, and then restored: the operator rolls the configuration back
or enables the filter again. Until now the operator then had to find those
records and redrive each one through the admin API, although the bridge already
knows the filter is back.
A second problem sat in the admin redrive itself. One 30-second bound covered a
whole redrive batch, and entries are redriven one after another. Since ADR 0017
a direct_hold route retries a failing send inside the bridge for its
send_retry_budget (60 s by default). Against a destination that was down, the
first entry of a batch could use all 30 seconds, and every later id came back
redrive deadline exceeded before entry lookup without being tried.
DLQEntry gains two fields. RedriveMode (redrive_mode) is "" (manual:
only an operator redrives the record; the default, and what every older
record reads back as) or "auto" (a matching system event may redrive it).
ExtraInfo (extra_info) is a map of string facts that such an event must
match. The names avoid “action”, which FailureAction, ExpiredAction,
FilteredAction and ports.AuditEvent.Action already use.auto even when automatic redrive is turned off.extra_info is always a
JSON object: {} when the record has no facts, never null.ErrorCode) it may redrive and
the ExtraInfo keys the event and the record must agree on. There is one
rule: the trigger subscription_added redrives SUBSCRIPTION_REMOVED
records, matching on session_id, managed_identity and subscription.
Another pair is another rule; the mechanism stays the same.redrive_mode: auto and
those three facts when the session reports its managed subscription identity:
the opaque fingerprint of the broker-side session that its durable filter
history is stored under. subscription is the removed filter exactly as
configured, for example $share/group/sensors/#. Without an identity the
record is manual, as before.auto, its ErrorCode is the rule’s, and every
key of the rule has the same non-empty value in the record and in the event.
A missing fact never matches.ports/session_hooks.go:
ManagedSubscriptionIdentityReporter and SubscriptionAddedHookConfigurer.
The MQTT (paho) session implements both.Start and in Graft, before session
goroutines begin, on every session that implements both capabilities and
reports a non-empty identity. It installs nothing without a DLQ store or with
the window turned off.Stop waits for it.subscribed and that the session’s single ingress route has a started route
runner. When the runtime is ready but the session has no single ingress route
(none, or several), the pass logs a warning and ends; the records stay for an
operator. A shutdown ends the wait.stores.dlq.auto_redrive_window: 24 hours by default, and 0s turns
automatic redrive off. It lists only records that failed before the pass
started or in its first millisecond, so a route that keeps dead-lettering
during the pass cannot keep it paging; those records wait for the next
event. The bound is exclusive and stores keep failed_at to the
millisecond, so it sits one millisecond past the start: a record written in
the pass’s own millisecond is still included. It reads pages of 100,
oldest first, paging forward from the last failed_at it saw and skipping
records it has already seen. It stops on a short page or on a page with
nothing new. Each list call has its own 30-second bound.delete_error; the record stays, and a later event may
redrive it again (at-least-once).dlq.redrive.auto: the actor
is the runtime’s instance ID, the resource is dlq, the resource ID is the
record ID, the outcome is success or failure, and the detail holds
route_id, session_id, subscription, and error or delete_error. The
counters DLQRedrives and DLQRedriveFailures move with the route_id tag,
as for an admin redrive.An admin redrive injects a synthetic delivery whose Retry answers “not
supported”. So a recoverable failure that the route would hand back to its
source becomes a new retry_unsupported dead-letter record. On the automatic
path that would add a record on every failed attempt. The automatic inject sets
a hold option instead: Retry returns an error, the route returns that error
without writing a record, and the original record stays the only one,
unchanged.
ports.ErrInjectNotDelivered means the route settled
this one message without delivering it: dropped, filtered, expired or
dead-lettered. The pass moves on to the next record.DeliveryPanics (route_id) as the route runner counts a panic
it recovers. It does not make the runtime terminal.managed_identity names one
broker-side session, so a member whose persistent session has its own client
ID, and so its own identity, never redrives another member’s records.redrive deadline exceeded
before entry lookup, not entry not found. An entry the batch never reaches
reports that label, or, on a store whose lookup ignores its context (the
in-memory store), an inject failed: … error that names the context
deadline.send_timeout, send_retry_budget, processor_timeout).
The wait for that slot is bounded only by the pass’s context, the runtime’s
work context, which has no deadline: behind a full route the pass waits
until a slot frees or the runtime stops.docs/runbooks/mqtt-managed-subscription-migration.md says what an
operator still does by hand.RouteConfig.SourceSessionID empty produces such records, since that field
is the only way the writer finds a session’s ingress route. The session a
caller passes to AddRoute is not used by identity instead: the builder
passes an egress binding’s session there for a route with no session block,
so an SQS-to-MQTT route would be named and a redrive would publish the
removed filter’s messages to its MQTT destination.0x11 (no subscription existed) the
removed-subscription dead-letter can succeed and the history Forget then
fail. The filter stays in the managed history, so adding it back before a
successful retry does not fire the trigger.failed_at
millisecond stop the paging for that pass: a full page of records already
seen gives nothing new. Later records wait for the next event.auto_redrive_window is a stores change, so a reload replaces
the whole runtime rather than reloading in place (ADR 0018 reloads only
sessions, receivers, senders, bindings and routes in place). The validator
rejects a malformed or negative window, and the key on any store role other
than dlq. A document without the key keeps its content identity, because
the normal form does not fill in the default.runtime.WithAutoRedriveWindow gets
the 24-hour default. ports.StoreConfig.AutoRedriveWindowDuration also gives
the default for a malformed or negative value that was never validated.SessionEvent kind for the trigger. The session event channel may
drop its oldest unread event under a storm, which would lose a trigger
without a trace, and the session manager loops would need a change to forward
the event to the runtime. A hook, installed the way
RemovedSubscriptionDeadLetterConfigurer is, cannot be dropped and needs no
change to those loops.