Skip to content

Implement AMQP sole conn spec - #16669

Merged
acogoluegnes merged 1 commit into
mainfrom
amqp-sole-conn
Sep 3, 2026
Merged

acogoluegnes merged 1 commit into
mainfrom
amqp-sole-conn

Conversation

@acogoluegnes

@acogoluegnes acogoluegnes commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

This commit implements the "AMQP Enforcing Connection Uniqueness
Version 1.0" specification extension. It introduces cluster-wide
tracking of AMQP 1.0 client connections to ensure only a single
connection can be established for a given container-id per vhost.

Implementation Details:

  • Introduces rabbit_sole_conn, a gen_server that manages
    a dedicated Khepri (Raft-based) store to track active connection
    leases across the cluster.
  • Updates rabbit_amqp_reader to parse the sole-connection-for-container
    capability and coordinate with the sole connection registry during
    the initial AMQP 1.0 open handshake.
  • Enforces two conflict resolution policies defined by the spec:
    • refuse-connection: Rejects the new connection with an invalid-field
      condition if an existing connection holds the lease.
    • close-existing: Terminates the existing connection with a
      resource-locked condition and grants the lease to the new connection.
  • Applies a weak detection policy, enforcing uniqueness only when
    explicitly requested by the client via connection properties.

Security and Semantics:

  • Connection leases are scoped strictly to the vhost and container-id.
  • Enforces user ownership: a lease can only be taken over or replaced
    (close-existing) by the same authenticated user. Attempts by different
    users to hijack an active container-id are unconditionally refused.

Operability:

  • Adds rabbitmqctl sole_connection_status to inspect the Raft consensus
    state of the sole connection registry.
  • Adds rabbitmqctl sole_connection_force_delete to allow operators to
    manually evict stale leases if necessary.
  • Introduces operator commands wipe and start for low-level recovery
    and bootstrapping of the Khepri store.

Configuration Parameters:

  • Expose the three configuration parameters of rabbit_sole_conn
    in rabbitmq.conf under the sole_connection prefix.
  • sole_connection.tick_interval -> rabbit.sole_connection_tick_interval
  • sole_connection.leader_wait_retry_timeout -> rabbit.sole_connection_leader_wait_retry_timeout
  • sole_connection.default_timeout -> rabbit.sole_connection_default_timeout

@mergify mergify Bot added the make label Jun 12, 2026
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 2 times, most recently from 36fc28f to 29d24bb Compare June 18, 2026 07:27
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 4 times, most recently from dc73317 to 15625cc Compare June 30, 2026 06:54
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 5 times, most recently from 94b5d5c to 9b3e12e Compare July 10, 2026 09:43
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 5 times, most recently from 577fafc to 7a1c325 Compare July 22, 2026 06:24
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 6 times, most recently from f237217 to 6db9fad Compare July 28, 2026 07:29
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 5 times, most recently from 60a19e7 to 8786e97 Compare August 5, 2026 12:05
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 2 times, most recently from 22d32dd to 94897fc Compare August 6, 2026 10:00
@acogoluegnes

Copy link
Copy Markdown
Contributor Author

@michaelklishin We removed the protocol prefix (I updated the PR description, it was outdated, but the code is correct). We use only the sole_connection prefix, as the feature could be used for other protocols. So it is no longer specific to AMQP 1.0, so using an amqp10. prefix would not be relevant.

acogoluegnes added a commit to rabbitmq/rabbitmq-website that referenced this pull request Aug 13, 2026
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 2 times, most recently from 57861c9 to 20c291c Compare August 18, 2026 13:51
acogoluegnes added a commit to rabbitmq/rabbitmq-website that referenced this pull request Aug 18, 2026
acogoluegnes added a commit to rabbitmq/rabbitmq-website that referenced this pull request Aug 19, 2026
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 4 times, most recently from f8d04f0 to f149f87 Compare August 20, 2026 06:33
acogoluegnes added a commit to rabbitmq/rabbitmq-website that referenced this pull request Aug 20, 2026

@dumbbell dumbbell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor comments

Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 3 times, most recently from 9c77067 to d03d229 Compare August 24, 2026 06:13
Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 2 times, most recently from 210d309 to 26a264a Compare September 2, 2026 07:49
@acogoluegnes acogoluegnes changed the title Implement AMQP sole conn spec (DO NOT MERGE YET) Implement AMQP sole conn spec Sep 2, 2026
Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
Comment thread deps/rabbit/src/rabbit_sole_conn.erl Resolved
@acogoluegnes
acogoluegnes force-pushed the amqp-sole-conn branch 2 times, most recently from a2984f9 to 50e0ac4 Compare September 3, 2026 06:40
This commit implements the "AMQP Enforcing Connection Uniqueness
Version 1.0" specification extension. It introduces cluster-wide
tracking of AMQP 1.0 client connections to ensure only a single
connection can be established for a given `container-id` per vhost.

Implementation Details:
* Introduces `rabbit_sole_conn`, a `gen_server` that manages
  a dedicated Khepri (Raft-based) store to track active connection
  leases across the cluster.
* Updates `rabbit_amqp_reader` to parse the `sole-connection-for-container`
  capability and coordinate with the sole connection registry during
  the initial AMQP 1.0 `open` handshake.
* Enforces two conflict resolution policies defined by the spec:
  - `refuse-connection`: Rejects the new connection with an `invalid-field`
    condition if an existing connection holds the lease.
  - `close-existing`: Terminates the existing connection with a
    `resource-locked` condition and grants the lease to the new connection.
* Applies a `weak` detection policy, enforcing uniqueness only when
  explicitly requested by the client via connection properties.

Security and Semantics:
* Connection leases are scoped strictly to the `vhost` and `container-id`.
* Enforces user ownership: a lease can only be taken over or replaced
  (`close-existing`) by the same authenticated user. Attempts by different
  users to hijack an active `container-id` are unconditionally refused.

Operability:
* Adds `rabbitmqctl sole_connection_status` to inspect the Raft consensus
  state of the sole connection registry.
* Adds `rabbitmqctl sole_connection_force_delete` to allow operators to
  manually evict stale leases if necessary.
* Introduces operator commands `wipe` and `start` for low-level recovery
  and bootstrapping of the Khepri store.

Configuration Parameters:
* Expose the three configuration parameters of `rabbit_sole_conn`
  in `rabbitmq.conf` under the `sole_connection` prefix.
* `sole_connection.tick_interval` -> `rabbit.sole_connection_tick_interval`
* `sole_connection.leader_wait_retry_timeout` -> `rabbit.sole_connection_leader_wait_retry_timeout`
* `sole_connection.default_timeout` -> `rabbit.sole_connection_default_timeout`
acogoluegnes added a commit to rabbitmq/rabbitmq-website that referenced this pull request Sep 3, 2026
@acogoluegnes
acogoluegnes merged commit 48f092d into main Sep 3, 2026
378 of 379 checks passed
@acogoluegnes
acogoluegnes deleted the amqp-sole-conn branch September 3, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants