diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-06-10 16:12:04 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-06-10 16:12:04 +0100 |
commit | 60775e2dc2eb6df4e686fdb167b91e50b71f3ca0 (patch) | |
tree | 6cb4a47bcbc0476637b553fb50ef5e5fb4dd7ddd | |
parent | 87c1aaa45f5d6868c0c0403c05ae21a2ae157bb9 (diff) | |
parent | 10aff661d3c4c2b818fb0ef61434e26e0d103207 (diff) | |
download | rabbitmq-server-60775e2dc2eb6df4e686fdb167b91e50b71f3ca0.tar.gz |
Merge heads of stable
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 10813838..8441bd3c 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}). |