Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Improve logging when the upstream exchange changes while adding bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dcorbacho authored and michaelklishin committed Jan 23, 2017
1 parent bac8024 commit c02f63b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/rabbit_federation_exchange_link.erl
Expand Up @@ -107,9 +107,17 @@ handle_cast(go, State) ->
handle_cast({enqueue, _, _}, State = {not_started, _}) ->
{noreply, State};

handle_cast({enqueue, Serial, Cmd}, State = #state{waiting_cmds = Waiting}) ->
handle_cast({enqueue, Serial, Cmd},
State = #state{waiting_cmds = Waiting,
downstream_exchange = XName}) ->
Waiting1 = gb_trees:insert(Serial, Cmd, Waiting),
{noreply, play_back_commands(State#state{waiting_cmds = Waiting1})};
try
{noreply, play_back_commands(State#state{waiting_cmds = Waiting1})}
catch exit:{{shutdown, {server_initiated_close, 404, Text}}, _} ->
rabbit_federation_link_util:log_warning(
XName, "detected upstream changes, restarting link: ~p~n", [Text]),
{stop, {shutdown, restart}, State}
end;

handle_cast(Msg, State) ->
{stop, {unexpected_cast, Msg}, State}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_federation_link_util.erl
Expand Up @@ -23,7 +23,7 @@
-export([start_conn_ch/5, disposable_channel_call/2, disposable_channel_call/3,
disposable_connection_call/3, ensure_connection_closed/1,
log_terminate/4, unacked_new/0, ack/3, nack/3, forward/9,
handle_down/6, get_connection_name/2]).
handle_down/6, get_connection_name/2, log_warning/3]).

%% temp
-export([connection_error/6]).
Expand Down

0 comments on commit c02f63b

Please sign in to comment.