summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-11-28 11:28:12 +0000
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-11-28 11:28:12 +0000
commitc554f590c987ed10178b5c8188e8f2ab40547206 (patch)
tree311eeb38c2928facf8d7dbbeb502d7d1c256b363 /src
parent82d1942f9ab7809ccdb331e1ea5343b031131edd (diff)
downloadrabbitmq-server-git-c554f590c987ed10178b5c8188e8f2ab40547206.tar.gz
death headers are now stored in an array of tables
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue_process.erl25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 13ed0671d2..981501f1a1 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -824,14 +824,23 @@ make_dead_letter_msg(DLX, Reason, Msg = #basic_message{content = Content},
#resource{name = QName} = qname(State),
- DeathHeaders = [{<<"x-death-reason">>, longstr,
- list_to_binary(atom_to_list(Reason))},
- {<<"x-death-queue">>, longstr, QName}],
-
- Headers1 = case Headers of
- undefined -> DeathHeaders;
- _ -> Headers ++ DeathHeaders
- end,
+ DeathTable = {table, [{<<"x-death-reason">>, longstr,
+ list_to_binary(atom_to_list(Reason))},
+ {<<"x-death-queue">>, longstr, QName}]},
+
+ Headers1 =
+ case Headers of
+ undefined ->
+ [{<<"x-death">>, array, [DeathTable]}];
+ _ ->
+ case rabbit_misc:table_lookup(Headers, <<"x-death">>) of
+ undefined ->
+ [{<<"x-death">>, array, [DeathTable]} | Headers];
+ {array, Prior} ->
+ rabbit_misc:set_table_value(
+ Headers, <<"x-death">>, array, [DeathTable | Prior])
+ end
+ end,
Content2 =
rabbit_binary_generator:clear_encoded_content(
Content1#content{properties = Props#'P_basic'{headers = Headers1}}),