summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_amqqueue_process.erl29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 1a86851d0a..05670774ce 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -142,6 +142,8 @@ init_it(Recover, From, State = #q{q = #amqqueue{exclusive_owner = Owner}}) ->
{_, Terms} = recovery_status(Recover),
BQS = bq_init(BQ, Q, Terms),
%% Rely on terminate to delete the queue.
+ log_auto_delete("Exclusive query connection closed",
+ Owner, State),
{stop, {shutdown, missing_owner},
State#q{backing_queue = BQ, backing_queue_state = BQS}}
end.
@@ -701,7 +703,9 @@ handle_ch_down(DownPid, State = #q{consumers = Consumers,
exclusive_consumer = Holder1},
notify_decorators(State2),
case should_auto_delete(State2) of
- true -> {stop, State2};
+ true ->
+ log_auto_delete("Channel down", DownPid, State),
+ {stop, State2};
false -> {ok, requeue_and_run(ChAckTags,
ensure_expiry_timer(State2))}
end
@@ -939,6 +943,7 @@ prioritise_call(Msg, _From, _Len, State) ->
prioritise_cast(Msg, _Len, State) ->
case Msg of
delete_immediately -> 8;
+ {delete_exclusive, _Pid} -> 8;
{set_ram_duration_target, _Duration} -> 8;
{set_maximum_since_use, _Age} -> 8;
{run_backing_queue, _Mod, _Fun} -> 6;
@@ -1063,7 +1068,9 @@ handle_call({basic_cancel, ChPid, ConsumerTag, OkMsg}, _From,
notify_decorators(State1),
case should_auto_delete(State1) of
false -> reply(ok, ensure_expiry_timer(State1));
- true -> stop(ok, State1)
+ true ->
+ log_auto_delete("basic.cancel request from", ChPid, State),
+ stop(ok, State1)
end
end;
@@ -1165,6 +1172,10 @@ handle_cast({reject, false, AckTags, ChPid}, State) ->
end) end,
fun () -> ack(AckTags, ChPid, State) end));
+handle_cast({delete_exclusive, ConnPid}, State) ->
+ log_auto_delete("Exclusive query connection closed", ConnPid, State),
+ stop(State);
+
handle_cast(delete_immediately, State) ->
stop(State);
@@ -1284,6 +1295,7 @@ handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason},
%% match what people expect (see bug 21824). However we need this
%% monitor-and-async- delete in case the connection goes away
%% unexpectedly.
+ log_auto_delete("Exclusive query connection closed", DownPid, State),
stop(State);
handle_info({'DOWN', _MonitorRef, process, DownPid, _Reason}, State) ->
@@ -1347,3 +1359,16 @@ handle_pre_hibernate(State = #q{backing_queue = BQ,
{hibernate, stop_rate_timer(State1)}.
format_message_queue(Opt, MQ) -> rabbit_misc:format_message_queue(Opt, MQ).
+
+log_auto_delete(Reason, Owner, State = #q{ q = #amqqueue{ name = Name } }) ->
+ rabbit_queue:log("Queue deleted automatically: Queue name: ~p Reason: "
+ ++ Reason ++ " ~p",
+ [Name, Owner]).
+
+
+
+
+
+
+
+