Skip to content

Add rabbit_khepri:fence/1 when MQTT client connects#15557

Merged
michaelklishin merged 1 commit into
mainfrom
mqtt-fence
Feb 25, 2026
Merged

Add rabbit_khepri:fence/1 when MQTT client connects#15557
michaelklishin merged 1 commit into
mainfrom
mqtt-fence

Conversation

@ansd

@ansd ansd commented Feb 25, 2026

Copy link
Copy Markdown
Member

What?

When an MQTT client connects to a RabbitMQ node, block until this RabbitMQ node applied the latest Khepri changes locally.

Why?

The new MQTT connection process must be aware of the latest MQTT session state due to various requirements in the MQTT spec, for example:

If a CONNECT packet is received with Clean Start set to 0 and there is a
Session associated with the Client Identifier, the Server MUST resume communications with the Client based on state from the existing Session

If the local member hangs behind, the local member must first catch up to determine the latest session state.

Imagine an MQTT client that re-connects from one RabbiMQ node A to another RabbitMQ node B that hangs behind. The connection on node B should be aware of the MQTT session state.

How?

We use a timeout of 30 seconds. If the local node can't apply the latest changes within 30 seconds, we mark it as unavailable and close the connection.

 ## What?
When an MQTT client connects to a RabbitMQ node, block until this
RabbitMQ node applied the latest Khepri changes locally.

 ## Why?
The new MQTT connection process must be aware of the latest MQTT session
state due to various requirements in the MQTT spec, for example:
> If a CONNECT packet is received with Clean Start set to 0 and there is a
Session associated with the Client Identifier, the Server MUST resume
communications with the Client based on state from the existing Session

If the local member hangs behind, the local member must first catch up
to determine the latest session state.

Imagine an MQTT client that re-connects from one RabbiMQ node A to another
RabbitMQ node B that hangs behind. The connection on node B should be
aware of the MQTT session state.

 ## How?
We use a timeout of 30 seconds. If the local node can't apply the latest
changes within 30 seconds, we mark it as unavailable and close the
connection.
@ansd
ansd marked this pull request as ready for review February 25, 2026 13:03
@ansd ansd assigned the-mikedavis and unassigned the-mikedavis Feb 25, 2026
@ansd
ansd requested a review from the-mikedavis February 25, 2026 18:21
@michaelklishin michaelklishin added this to the 4.3.0 milestone Feb 25, 2026
@michaelklishin
michaelklishin merged commit 79f6f16 into main Feb 25, 2026
200 of 202 checks passed
@michaelklishin
michaelklishin deleted the mqtt-fence branch February 25, 2026 21:56
michaelklishin added a commit that referenced this pull request Feb 26, 2026
Add `rabbit_khepri:fence/1` when MQTT client connects (backport #15557)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants