Support exchange federation with MQTT 5.0 subscribers #13115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This commit fixes #13040.
Prior to this commit, exchange federation crashed if the MQTT topic exchange
(
amq.topic
by default) got federated and MQTT 5.0 clients subscribed on thedownstream. That's because the federation plugin sends bindings from downstream
to upstream via AMQP 0.9.1. However, binding arguments containing Erlang record
mqtt_subscription_opts
(henceforth binding args v1) cannot be encoded in AMQP 0.9.1.Why?
Federating the MQTT topic exchange could be useful for warm standby use cases.
How?
This commit makes binding arguments a valid AMQP 0.9.1 table (henceforth
binding args v2).
Binding args v2 can only be used if all nodes support it. Hence binding
args v2 comes with feature flag
rabbitmq_4.1.0
. Note that the AMQPover WebSocket
PR already
introduces this same feature flag. Although the feature flag subsystem
supports plugins to define their own feature flags, and the MQTT plugin
defined its own feature flags in the past, reusing feature flag
rabbitmq_4.1.0
is simpler.This commit also avoids database migrations for both Mnesia and Khepri
if feature flag
rabbitmq_4.1.0
gets enabled. Instead, it's simpler tomigrate binding args v1 to binding args v2 at MQTT connection establishment
time if the feature flag is enabled. (If the feature flag is disabled at
connection etablishment time, but gets enabled during the connection
lifetime, the connection keeps using bindings args v1.)
This commit adds two new suites:
federation_SUITE
which tests that federating the MQTT topicexchange works, and
feature_flag_SUITE
which tests the binding args migration from v1 to v2