diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-06-10 16:12:16 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-06-10 16:12:16 +0100 |
commit | bd842410d3b73b4e509d7e42f9a3115fc2224d34 (patch) | |
tree | fcfd857e06fa16114b080f9bb47096efaa90dfea | |
parent | 761e52a4a4da990737d24da6f78cbb8d3311b759 (diff) | |
parent | 60775e2dc2eb6df4e686fdb167b91e50b71f3ca0 (diff) | |
download | rabbitmq-server-bd842410d3b73b4e509d7e42f9a3115fc2224d34.tar.gz |
stable to default
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index d2f4a178..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}). @@ -1052,7 +1065,8 @@ handle_call({init, Recover}, From, gen_server2:reply(From, not_found), case Recover of new -> rabbit_log:warning( - "Queue ~p exclusive owner went away~n", [QName]); + "Queue ~p exclusive owner went away~n", + [rabbit_misc:rs(QName)]); _ -> ok end, BQS = bq_init(BQ, Q, Recover), |