rabbitmq-server/deps/rabbitmq_mqtt/Makefile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

152 lines
5.3 KiB
Makefile
Raw Permalink Normal View History

2015-10-19 18:28:46 +08:00
PROJECT = rabbitmq_mqtt
PROJECT_DESCRIPTION = RabbitMQ MQTT Adapter
PROJECT_MOD = rabbit_mqtt
define PROJECT_ENV
[
{ssl_cert_login,false},
{allow_anonymous, true},
{vhost, <<"/">>},
{exchange, <<"amq.topic">>},
2023-07-13 22:38:47 +08:00
{max_session_expiry_interval_seconds, 86400}, %% 1 day
{retained_message_store, rabbit_mqtt_retained_msg_store_dets},
%% only used by DETS store
{retained_message_store_dets_sync_interval, 2000},
{prefetch, 10},
{ssl_listeners, []},
{tcp_listeners, [1883]},
{num_tcp_acceptors, 10},
{num_ssl_acceptors, 10},
{tcp_listen_options, [{backlog, 128},
{nodelay, true},
{send_timeout, 15000},
{send_timeout_close, true}
]},
{proxy_protocol, false},
{sparkplug, false},
{mailbox_soft_limit, 200},
{max_packet_size_unauthenticated, 65536},
%% 256 MB is upper limit defined by MQTT spec
%% We set 16 MB as defined in deps/rabbit/Makefile max_message_size
{max_packet_size_authenticated, 16777216},
{topic_alias_maximum, 16}
]
endef
2015-10-19 18:28:46 +08:00
2016-12-07 22:48:04 +08:00
define PROJECT_APP_EXTRA_KEYS
{broker_version_requirements, []}
endef
2015-10-19 18:28:46 +08:00
# We do not need QUIC as dependency of emqtt.
BUILD_WITHOUT_QUIC=1
export BUILD_WITHOUT_QUIC
LOCAL_DEPS = ssl
DEPS = ranch rabbit amqp10_common
TEST_DEPS = cowlib emqtt ct_helper rabbitmq_ct_helpers rabbitmq_ct_client_helpers rabbitmq_management amqp_client rabbitmq_consistent_hash_exchange rabbitmq_amqp_client rabbitmq_stomp rabbitmq_stream rabbitmq_federation
2016-03-03 00:57:48 +08:00
PLT_APPS += rabbitmq_cli elixir
dep_ct_helper = git https://github.com/extend/ct_helper.git master
dep_emqtt = git https://github.com/emqx/emqtt.git 1.11.0
2015-10-19 18:28:46 +08:00
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
2015-10-19 18:28:46 +08:00
DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk
include ../../rabbitmq-components.mk
include ../../erlang.mk
2016-09-23 23:42:21 +08:00
2016-09-24 00:19:03 +08:00
clean::
if test -d test/java_SUITE_data; then cd test/java_SUITE_data && $(MAKE) clean; fi
2024-09-25 18:24:08 +08:00
# Parallel CT.
#
# @todo Move most of this in common files.
define ct_master.erl
StartOpts = #{
host => "localhost",
connection => standard_io,
args => ["-hidden"]
},
{ok, Pid1, _} = peer:start(StartOpts#{name => "rabbit_shard1"}),
{ok, Pid2, _} = peer:start(StartOpts#{name => "rabbit_shard2"}),
{ok, Pid3, _} = peer:start(StartOpts#{name => "rabbit_shard3"}),
{ok, Pid4, _} = peer:start(StartOpts#{name => "rabbit_shard4"}),
peer:call(Pid1, net_kernel, set_net_ticktime, [5]),
peer:call(Pid2, net_kernel, set_net_ticktime, [5]),
peer:call(Pid3, net_kernel, set_net_ticktime, [5]),
peer:call(Pid4, net_kernel, set_net_ticktime, [5]),
peer:call(Pid1, persistent_term, put, [rabbit_ct_tcp_port_base, 23000]),
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 25000]),
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 27000]),
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 29000]),
[{[_], {ok, Results}}] = ct_master_fork:run("$1"),
peer:stop(Pid4),
peer:stop(Pid3),
peer:stop(Pid2),
peer:stop(Pid1),
lists:foldl(fun
({_, {_, 0, {_, 0}}}, Err) -> Err + 1;
(What, Peer) -> halt(Peer)
end, 1, Results),
halt(0)
endef
Support exchange federation with MQTT 5.0 subscribers ## 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 the downstream. 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 AMQP over WebSocket [PR](https://github.com/rabbitmq/rabbitmq-server/pull/13071) 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 to migrate 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: 1. `federation_SUITE` which tests that federating the MQTT topic exchange works, and 2. `feature_flag_SUITE` which tests the binding args migration from v1 to v2.
2025-01-21 17:34:52 +08:00
PARALLEL_CT_SET_1_A = auth retainer federation feature_flag
PARALLEL_CT_SET_1_B = cluster command config config_schema mc_mqtt packet_prop \
processor protocol_interop proxy_protocol rabbit_mqtt_confirms reader util
PARALLEL_CT_SET_1_C = java v5
PARALLEL_CT_SET_1_D = mqtt_shared
PARALLEL_CT_SUITES = $(PARALLEL_CT_SET_1_A) $(PARALLEL_CT_SET_1_B) $(PARALLEL_CT_SET_1_C) $(PARALLEL_CT_SET_1_D)
ifeq ($(filter-out $(SEQUENTIAL_CT_SUITES) $(PARALLEL_CT_SUITES),$(CT_SUITES)),)
parallel-ct-sanity-check:
$(verbose) :
else
parallel-ct-sanity-check:
$(verbose) printf "%s\n" \
"In order for new test suites to be run in CI, the test suites" \
"must be added to one of the PARALLEL_CT_SET_<N>_<M> variables." \
"" \
"The following test suites are missing:" \
"$(filter-out $(SEQUENTIAL_CT_SUITES) $(PARALLEL_CT_SUITES),$(CT_SUITES))"
$(verbose) exit 1
endif
define tpl_parallel_ct_test_spec
{logdir, "$(CT_LOGS_DIR)"}.
{logdir, master, "$(CT_LOGS_DIR)"}.
{create_priv_dir, all_nodes, auto_per_run}.
{auto_compile, false}.
{node, shard1, 'rabbit_shard1@localhost'}.
{node, shard2, 'rabbit_shard2@localhost'}.
{node, shard3, 'rabbit_shard3@localhost'}.
{node, shard4, 'rabbit_shard4@localhost'}.
{define, 'Set1', [$(call comma_list,$(addsuffix _SUITE,$1))]}.
{define, 'Set2', [$(call comma_list,$(addsuffix _SUITE,$2))]}.
{define, 'Set3', [$(call comma_list,$(addsuffix _SUITE,$3))]}.
{define, 'Set4', [$(call comma_list,$(addsuffix _SUITE,$4))]}.
{suites, shard1, "test/", 'Set1'}.
{suites, shard2, "test/", 'Set2'}.
{suites, shard3, "test/", 'Set3'}.
{suites, shard4, "test/", 'Set4'}.
endef
define parallel_ct_set_target
tpl_parallel_ct_test_spec_set_$1 = $$(call tpl_parallel_ct_test_spec,$(PARALLEL_CT_SET_$(1)_A),$(PARALLEL_CT_SET_$(1)_B),$(PARALLEL_CT_SET_$(1)_C),$(PARALLEL_CT_SET_$(1)_D))
parallel-ct-set-$(1): test-build
$(verbose) mkdir -p $(CT_LOGS_DIR)
$(verbose) $$(call core_render,tpl_parallel_ct_test_spec_set_$(1),ct.set-$(1).spec)
$$(eval ERL := erl -noinput -boot no_dot_erlang)
$$(call erlang,$$(call ct_master.erl,ct.set-$(1).spec),-sname parallel_ct_$(PROJECT)@localhost -hidden -kernel net_ticktime 5)
endef
$(foreach set,1,$(eval $(call parallel_ct_set_target,$(set))))