@@ -579,17 +579,22 @@ add_exchange_int(_Exchange, R = #resource{kind = exchange,
579579 rabbit_log :warning (" Skipping import of an exchange whose name begins with 'amq.', "
580580 " name: ~s , acting user: ~s " , [Name , ActingUser ]);
581581add_exchange_int (Exchange , Name , ActingUser ) ->
582- Internal = case maps :get (internal , Exchange , undefined ) of
583- undefined -> false ; % % =< 2.2.0
584- I -> I
585- end ,
586- rabbit_exchange :declare (Name ,
587- rabbit_exchange :check_type (maps :get (type , Exchange , undefined )),
588- maps :get (durable , Exchange , undefined ),
589- maps :get (auto_delete , Exchange , undefined ),
590- Internal ,
591- args (maps :get (arguments , Exchange , undefined )),
592- ActingUser ).
582+ case rabbit_exchange :lookup (Name ) of
583+ {ok , _ } ->
584+ ok ;
585+ {error , not_found } ->
586+ Internal = case maps :get (internal , Exchange , undefined ) of
587+ undefined -> false ; % % =< 2.2.0
588+ I -> I
589+ end ,
590+ rabbit_exchange :declare (Name ,
591+ rabbit_exchange :check_type (maps :get (type , Exchange , undefined )),
592+ maps :get (durable , Exchange , undefined ),
593+ maps :get (auto_delete , Exchange , undefined ),
594+ Internal ,
595+ args (maps :get (arguments , Exchange , undefined )),
596+ ActingUser )
597+ end .
593598
594599add_binding (Binding , ActingUser ) ->
595600 DestType = dest_type (Binding ),
0 commit comments