summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-12-05 13:11:33 +0000
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-12-05 13:11:33 +0000
commit9dff074041a1107c799e3911fa3854c850f2984a (patch)
tree886204b784e22bde28a8b370f85fb40ff763a0b8
parent6344212b8cf87795985c78130d8c4e818e33ae94 (diff)
downloadrabbitmq-server-git-9dff074041a1107c799e3911fa3854c850f2984a.tar.gz
record routing keys and exchanges when dead-lettering
We don't record BCC routing keys, only basic.publish and CC ones. Also, there's little reason to prefix the individual fields in the "x-death" table with "x-death-", so don't.
-rw-r--r--src/rabbit_amqqueue_process.erl20
-rw-r--r--src/rabbit_basic.erl3
2 files changed, 16 insertions, 7 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 56961b6ade..e0472b6442 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -826,20 +826,28 @@ cleanup_after_confirm(State = #q{blocked_op = Op,
noreply(State1#q{blocked_op = Op})
end.
-make_dead_letter_msg(DLX, Reason, Msg = #basic_message{content = Content},
+make_dead_letter_msg(DLX, Reason,
+ Msg = #basic_message{content = Content,
+ exchange_name = Exchange,
+ routing_keys = RoutingKeys},
State) ->
-
Content1 = #content{
properties = Props = #'P_basic'{headers = Headers}} =
rabbit_binary_parser:ensure_content_decoded(Content),
#resource{name = QName} = qname(State),
- DeathTable = {table, [{<<"x-death-reason">>, longstr,
+ %% The first routing key is the one specified in the
+ %% basic.publish; all others are CC or BCC keys.
+ RoutingKeys1 = [hd(RoutingKeys) | rabbit_basic:header_routes(Headers)],
+ DeathTable = {table, [{<<"reason">>, longstr,
list_to_binary(atom_to_list(Reason))},
- {<<"x-death-queue">>, longstr, QName},
- {<<"x-death-time">>, longstr,
- list_to_binary(httpd_util:rfc1123_date())}]},
+ {<<"queue">>, longstr, QName},
+ {<<"time">>, longstr,
+ list_to_binary(httpd_util:rfc1123_date())},
+ {<<"exchange">>, longstr, Exchange#resource.name},
+ {<<"routing-key">>, array,
+ [{longstr, Key} || Key <- RoutingKeys1]}]},
Headers1 =
case Headers of
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index b266d3664d..bc2f6ea994 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -19,7 +19,8 @@
-include("rabbit_framing.hrl").
-export([publish/4, publish/6, publish/1,
- message/3, message/4, properties/1, delivery/4]).
+ message/3, message/4, properties/1, delivery/4,
+ header_routes/1]).
-export([build_content/2, from_content/1]).
%%----------------------------------------------------------------------------