summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-04-19 14:14:19 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-04-19 14:14:19 +0100
commit9490a9374f425a292299cd899e03f34293167867 (patch)
treee306ffc150e7d7213eed600da56851ba228442c6 /src
parent09151103684bd5e76e5b3196d1faa70a2aadcee5 (diff)
downloadrabbitmq-server-9490a9374f425a292299cd899e03f34293167867.tar.gz
Checking for existance of DLX in dead_letter_publish
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 2063e557..fe8fac45 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -724,13 +724,6 @@ dead_letter_fun(Reason, _State) ->
gen_server2:cast(self(), {dead_letter, {Msg, AckTag}, Reason})
end.
-dead_letter_msg(Msg, AckTag, Reason, State = #q{dlx = DLX}) ->
- case rabbit_exchange:lookup(DLX) of
- {error, not_found} -> noreply(State);
- _ -> dead_letter_msg_existing_dlx(Msg, AckTag, Reason,
- State)
- end.
-
dead_letter_publish(Msg, Reason,
State = #q{publish_seqno = MsgSeqNo,
dlx = DLX}) ->
@@ -738,17 +731,20 @@ dead_letter_publish(Msg, Reason,
rabbit_basic:delivery(
false, false, make_dead_letter_msg(DLX, Reason, Msg, State),
MsgSeqNo),
- {ok, X} = rabbit_exchange:lookup(XName),
- Queues = rabbit_exchange:route(X, Delivery),
- {Queues1, Cycles} = detect_dead_letter_cycles(Delivery, Queues),
- lists:foreach(fun log_cycle_once/1, Cycles),
- QPids = rabbit_amqqueue:lookup(Queues1),
- {_, DeliveredQPids} = rabbit_amqqueue:deliver(QPids, Delivery),
- DeliveredQPids.
-
-dead_letter_msg_existing_dlx(Msg, AckTag, Reason,
- State = #q{publish_seqno = MsgSeqNo,
- unconfirmed = UC}) ->
+ case rabbit_exchange:lookup(XName) of
+ {ok, X} ->
+ Queues = rabbit_exchange:route(X, Delivery),
+ {Queues1, Cycles} = detect_dead_letter_cycles(Delivery, Queues),
+ lists:foreach(fun log_cycle_once/1, Cycles),
+ QPids = rabbit_amqqueue:lookup(Queues1),
+ {_, DeliveredQPids} = rabbit_amqqueue:deliver(QPids, Delivery),
+ DeliveredQPids;
+ {error, not_found} ->
+ []
+ end.
+
+dead_letter_msg(Msg, AckTag, Reason, State = #q{publish_seqno = MsgSeqNo,
+ unconfirmed = UC}) ->
QPids = dead_letter_publish(Msg, Reason, State),
State1 = State#q{queue_monitors = pmon:monitor_all(
QPids, State#q.queue_monitors),