~ubuntu-branches/ubuntu/saucy/rabbitmq-server/saucy-proposed

« back to all changes in this revision

Viewing changes to plugins-src/rabbitmq-federation/src/rabbit_federation_link.erl

  • Committer: Package Import Robot
  • Author(s): Emile Joubert
  • Date: 2012-12-11 15:47:52 UTC
  • mfrom: (0.2.19) (0.1.33 sid)
  • Revision ID: package-import@ubuntu.com-20121211154752-gvq8tpx6tj3v89ek
Tags: 3.0.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
    gen_server2:start_link(?MODULE, Args, [{timeout, infinity}]).
74
74
 
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
 
81
        {ok, _} ->
 
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}};
 
87
        {error, not_found} ->
 
88
            {stop, gone}
 
89
    end.
81
90
 
82
91
handle_call(list_routing_keys, _From, State = #state{bindings = Bindings}) ->
83
92
    {reply, lists:sort([K || {K, _} <- dict:fetch_keys(Bindings)]), State};