6363 {requires , pre_boot },
6464 {enables , external_infrastructure }]}).
6565
66+ -rabbit_boot_step ({feature_flags ,
67+ [{description , " feature flags registry and initial state" },
68+ {mfa , {rabbit_feature_flags , init , []}},
69+ {requires , pre_boot },
70+ {enables , external_infrastructure }]}).
71+
6672-rabbit_boot_step ({database ,
6773 [{mfa , {rabbit_mnesia , init , []}},
6874 {requires , file_handle_cache },
@@ -314,9 +320,11 @@ start() ->
314320 HipeResult = rabbit_hipe :maybe_hipe_compile (),
315321 ok = start_logger (),
316322 rabbit_hipe :log_hipe_result (HipeResult ),
323+ Apps = load_all_apps (),
324+ rabbit_feature_flags :initialize_registry (),
317325 rabbit_node_monitor :prepare_cluster_status_files (),
318326 rabbit_mnesia :check_cluster_consistency (),
319- broker_start ()
327+ broker_start (Apps )
320328 end ).
321329
322330boot () ->
@@ -326,13 +334,15 @@ boot() ->
326334 HipeResult = rabbit_hipe :maybe_hipe_compile (),
327335 ok = start_logger (),
328336 rabbit_hipe :log_hipe_result (HipeResult ),
337+ Apps = load_all_apps (),
338+ rabbit_feature_flags :initialize_registry (),
329339 rabbit_node_monitor :prepare_cluster_status_files (),
330340 ok = rabbit_upgrade :maybe_upgrade_mnesia (),
331341 % % It's important that the consistency check happens after
332342 % % the upgrade, since if we are a secondary node the
333343 % % primary node will have forgotten us
334344 rabbit_mnesia :check_cluster_consistency (),
335- broker_start ()
345+ broker_start (Apps )
336346 end ).
337347
338348ensure_config () ->
@@ -347,11 +357,14 @@ ensure_config() ->
347357 ok -> ok
348358 end .
349359
350-
351- broker_start () ->
360+ load_all_apps () ->
352361 Plugins = rabbit_plugins :setup (),
353362 ToBeLoaded = Plugins ++ ? APPS ,
354- start_apps (ToBeLoaded ),
363+ app_utils :load_applications (ToBeLoaded ),
364+ ToBeLoaded .
365+
366+ broker_start (Apps ) ->
367+ start_loaded_apps (Apps ),
355368 maybe_sd_notify (),
356369 ok = rabbit_lager :broker_is_started (),
357370 ok = log_broker_started (rabbit_plugins :strictly_plugins (rabbit_plugins :active ())).
@@ -533,6 +546,13 @@ start_apps(Apps) ->
533546
534547start_apps (Apps , RestartTypes ) ->
535548 app_utils :load_applications (Apps ),
549+ ok = rabbit_feature_flags :refresh_feature_flags_after_app_load (Apps ),
550+ start_loaded_apps (Apps , RestartTypes ).
551+
552+ start_loaded_apps (Apps ) ->
553+ start_loaded_apps (Apps , #{}).
554+
555+ start_loaded_apps (Apps , RestartTypes ) ->
536556 ensure_sysmon_handler_app_config (),
537557 ConfigEntryDecoder = case application :get_env (rabbit , config_entry_decoder ) of
538558 undefined ->
0 commit comments