Status: accepted Date: 2026-10-09 Deciders: GoBridge core Amends: 0003 (the managed subscription history key, and a durable session may now be removed or renamed by a live reload), 0018 (retiring a reload unit may end the broker state the unit leaves behind), 0022 (switching the protocol version keeps the managed subscription history) Relates to: 0011, 0013, 0019, 0020
Some subscriptions live on the broker, not in GoBridge, and outlive the
connection that made them. The broker files that state under an identity the
broker knows, not under GoBridge’s session_id:
container_id and the link name. GoBridge attaches it
with expiry policy never (receiverLinkOptions in
adapters/amqp/transport/amqp10/acl_session.go), so it is never removed.When GoBridge changes the identity it uses — a new client ID, another broker, a
new container_id or link name — or removes the session, it connects as a
different identity, or not at all. The old state stays on the broker:
BLOCK when full stops its producers;$share), Mosquitto and EMQX keep handing
part of the group’s traffic to the offline old member until its session
expires (MQTT 5 §4.8.2 allows it). That traffic is lost to GoBridge.v0.7.1 refuses a live reload that changes the identity of a Persistent or
Exclusive MQTT session, or removes or renames one. The Supervisor, the AWS
runtime (through bridge.ValidateDurableReload) and the cluster rollout
preflight all run the same comparison. The documented way out is to store the
new configuration and restart the task.
That rule protects nothing:
session_id, so
renaming only the GoBridge session_id is refused although the broker sees no
change. The managed subscription history is stored under a fingerprint that
also covers the session mode, clean start, expiry and protocol version. None
of those change which broker session the client ID reaches (MQTT 5 §3.1.3.1),
so changing the expiry files the same broker session’s history under a new
key, and the filters it recorded are never unsubscribed.A live reload accepts a change to a durable subscription’s broker identity, and the removal of the subscription. Retiring the old reload unit ends the old identity’s state on the broker. Nothing is refused, and no restart is needed.
The durable session identity comparison is deleted from the Supervisor’s apply
path, from bridge.ValidateDurableReload (and so from
bridge.ValidateDormantReactivation and the AWS runtime’s apply), and from the
cluster rollout preflight. The change becomes an ordinary reload: the reload
unit that holds the session is retired and the new one is added
(ADR 0018), serialized as today.
Two things stay:
bridge.ValidateDurableReload are unchanged: a
repointed store, a changed lease session_id, and a removed outbox or DLQ
store. They are not part of this decision.A broker state key names one piece of broker-side state that outlives a connection. Two equal keys are the same state.
| Transport | When it has a key | The key |
|---|---|---|
| MQTT | Persistent or Exclusive session | the canonical broker endpoint and the effective client ID (what DurableSessionIdentityDomains computes today) |
| AMQP 1.0 | receiver with durability_mode above 0 on a topic (multicast) address |
the canonical broker endpoint, the container_id and the effective link name |
| everything else | never | — |
The session mode, clean start, session expiry and MQTT protocol version are not part of the MQTT key; changing them reconnects the same broker session. A receiver on a queue (anycast) address never has a key, so GoBridge never deletes a queue.
Keys are computed from the configuration, not from running instances, by an optional transport factory capability that is given a session and the receivers bound to it. They have to be known before anything is retired: a serialized reload retires the old units before it builds the new ones.
A reload compares the keys of the whole running configuration with the keys of
the whole next configuration. A key in the running configuration that is not in
the next one is lost. Comparing whole configurations means renaming only a
session_id loses nothing, because the broker identity is still there.
Runtime.Retire handles a session that holds a lost key in this order:
Only an instance that is connected (MQTT) or attached (AMQP 1.0) at that moment, and that holds the lease when the session is lease-managed, ends anything. A cluster standby never connected as the identity and does nothing.
How the state is ended, through an optional capability of the MQTT session and the AMQP 1.0 receiver:
CleanSession=1.detach with
closed=true, AMQP 1.0 transport §2.6.6), and Artemis and Qpid Broker-J
delete a durable topic subscription on a closing detach. Today the adapter
drops the connection precisely to avoid that delete; it still does so for
every retire that loses no key. A durable receiver must have its session to
itself (Session.reserveLink refuses any other link beside it), so ending
the state of one session ends the subscription of exactly one receiver.The step is bounded by the transport’s connect timeout, and is abandoned when
it cannot finish before the local deadline of the lease the instance holds.
When it fails — access denied, broker unreachable — the session logs a Warn
naming session_id and counts the failure in a metric, and the reload
continues. The state is then
left as it was before this decision: it expires (MQTT) or stays (AMQP 1.0).
A full replacement (prepare-commit or overlap swap) gives the old runtime’s
Stop the same set of lost keys.
Nothing else ends broker state: not a shutdown, a restart, a pause
(StopBridge), a lease loss or failover, the rebuild of a failed session
(ADR 0020), or the
reload of a unit whose keys all survive.
The history is stored under a SHA-256 digest of the MQTT broker state key, so the store still holds no client ID or broker URL. Changing the expiry, clean start, mode or protocol version keeps the history.
Upgrade. When no history exists under the new key, the session reads the history stored under the old fingerprint once and stores it under the new key. The old fingerprint function remains only for that lookup.
A key a reload adds. When a live reload adds a broker state key that the running configuration did not have — a new client ID, or a new durable session — the runtime records an empty history for it unless one already exists. A session that starts with an empty history first ends whatever broker session its client ID may still have, so the broker holds nothing the history does not know. An existing history is kept, never emptied: it describes what the broker may still hold for that client ID, or another cluster member has already filled it, and the reconcile removes the filters the plan no longer has. At process start, with no running configuration to compare with, the existing rule is unchanged: a durable session with no history needs a seeded baseline.
session_id with the GoBridge
session ID. They tagged it with the client ID.drain_timeout
before the state is ended: at-least-once, as on any retire. If the drain does
not settle every delivery within drain_timeout, the state is kept (a Warn
and BrokerStateEndFailures). The state is also kept when a delivery the
MQTT session or the AMQP 1.0 receiver received is still unsettled when it
closes, such as one that arrived after the drain and was dropped when the
route was cancelled.$share,
only when the group has no other member.| Broker | Ending the state |
|---|---|
| MQTT 5 and 3.1.1 brokers | The session is deleted, including its shared subscription membership. |
| ActiveMQ Artemis | The subscription queue and its messages are deleted when no other consumer is attached. The user needs the deleteDurableQueue permission. |
| Qpid Broker-J | The durable subscription is deleted. |
| Solace | Not deleted: Solace deletes a durable topic endpoint only on a closing detach with a null source, which go-amqp cannot send. The failure is logged. |
| RabbitMQ 4 (AMQP 1.0), Service Bus, SQS | Nothing to end: these addresses are queues or entities provisioned outside GoBridge. |
container_id or subscription
name, and remove a link with a live reload, on a single task and in a cluster
through the coordinated rollout (ADR 0013).$share groups Mosquitto and EMQX keep routing part of
the traffic to the offline member, and an AMQP 1.0 durable subscription keeps
collecting messages forever.