73
73
gen_server2:start_link(?MODULE, Args, [{timeout, infinity}]).
75
75
init(Args = {Upstream, XName}) ->
76
rabbit_federation_status:report(Upstream, XName, starting),
77
join(rabbit_federation_exchanges),
78
join({rabbit_federation_exchange, XName}),
79
gen_server2:cast(self(), maybe_go),
80
{ok, {not_started, Args}}.
76
%% If we are starting up due to a policy change then it's possible
77
%% for the exchange to have been deleted before we got here, in which
78
%% case it's possible that delete callback would also have been called
79
%% before we got here. So check if we still exist.
80
case rabbit_exchange:lookup(XName) of
82
rabbit_federation_status:report(Upstream, XName, starting),
83
join(rabbit_federation_exchanges),
84
join({rabbit_federation_exchange, XName}),
85
gen_server2:cast(self(), maybe_go),
86
{ok, {not_started, Args}};
82
91
handle_call(list_routing_keys, _From, State = #state{bindings = Bindings}) ->
83
92
{reply, lists:sort([K || {K, _} <- dict:fetch_keys(Bindings)]), State};