summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-06-10 16:11:42 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-06-10 16:11:42 +0100
commit10aff661d3c4c2b818fb0ef61434e26e0d103207 (patch)
tree246bca14f0d5904b84717e048786b36173833e88
parent202a36f38bf480d4833f4f9847d03006c8d00952 (diff)
parent1dae0adaa07263f38c65c543bf665c6dd9b39f54 (diff)
downloadrabbitmq-server-10aff661d3c4c2b818fb0ef61434e26e0d103207.tar.gz
Merge bug25588
-rw-r--r--src/rabbit_amqqueue_process.erl21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index d2f4a178..3a6759f1 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -898,6 +898,7 @@ make_dead_letter_msg(Msg = #basic_message{content = Content,
end,
ReasonBin = list_to_binary(atom_to_list(Reason)),
TimeSec = rabbit_misc:now_ms() div 1000,
+ PerMsgTTL = per_msg_ttl_header(Content#content.properties),
HeadersFun2 =
fun (Headers) ->
%% The first routing key is the one specified in the
@@ -908,13 +909,25 @@ make_dead_letter_msg(Msg = #basic_message{content = Content,
{<<"queue">>, longstr, QName},
{<<"time">>, timestamp, TimeSec},
{<<"exchange">>, longstr, Exchange#resource.name},
- {<<"routing-keys">>, array, RKs1}],
+ {<<"routing-keys">>, array, RKs1}] ++ PerMsgTTL,
HeadersFun1(rabbit_basic:prepend_table_header(<<"x-death">>,
Info, Headers))
end,
- Content1 = rabbit_basic:map_headers(HeadersFun2, Content),
- Msg#basic_message{exchange_name = DLX, id = rabbit_guid:gen(),
- routing_keys = DeathRoutingKeys, content = Content1}.
+ Content1 = #content{properties = Props} =
+ rabbit_basic:map_headers(HeadersFun2, Content),
+ Content2 = Content1#content{properties =
+ Props#'P_basic'{expiration = undefined}},
+ Msg#basic_message{exchange_name = DLX,
+ id = rabbit_guid:gen(),
+ routing_keys = DeathRoutingKeys,
+ content = Content2}.
+
+per_msg_ttl_header(#'P_basic'{expiration = undefined}) ->
+ [];
+per_msg_ttl_header(#'P_basic'{expiration = Expiration}) ->
+ [{<<"original-expiration">>, longstr, Expiration}];
+per_msg_ttl_header(_) ->
+ [].
now_micros() -> timer:now_diff(now(), {0,0,0}).