@@ -1391,17 +1391,18 @@ dead_letter_headers_BCC(Config) ->
13911391 routing_key = DLXQName }),
13921392
13931393 P1 = <<" msg1" >>,
1394- BCCHeader = {<<" BCC" >>, array , [{longstr , DLXQName }]},
1395- publish (Ch , QName , [P1 ], [BCCHeader ]),
1394+ CCHeader = {<<" CC" >>, array , [{longstr , <<" cc 1" >>}, {longstr , <<" cc 2" >>}]},
1395+ BCCHeader = {<<" BCC" >>, array , [{longstr , DLXQName }, {longstr , <<" bcc 2" >>}]},
1396+ publish (Ch , QName , [P1 ], [CCHeader , BCCHeader ]),
13961397 % % Message is published to both queues because of BCC header and DLX queue bound to both
13971398 % % exchanges
13981399 wait_for_messages (Config , [[QName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
13991400 {# 'basic.get_ok' {delivery_tag = DTag1 }, # amqp_msg {payload = P1 ,
14001401 props = # 'P_basic' {headers = Headers1 }}} =
1401- amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
1402+ amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
14021403 {# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
14031404 props = # 'P_basic' {headers = Headers2 }}} =
1404- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1405+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
14051406 % % We check the headers to ensure no dead lettering has happened
14061407 ? assertEqual (undefined , header_lookup (Headers1 , <<" x-death" >>)),
14071408 ? assertEqual (undefined , header_lookup (Headers2 , <<" x-death" >>)),
@@ -1413,10 +1414,15 @@ dead_letter_headers_BCC(Config) ->
14131414 wait_for_messages (Config , [[DLXQName , <<" 2" >>, <<" 1" >>, <<" 1" >>]]),
14141415 {# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
14151416 props = # 'P_basic' {headers = Headers3 }}} =
1416- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1417+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
14171418 consume_empty (Ch , QName ),
14181419 ? assertEqual (undefined , rabbit_misc :table_lookup (Headers3 , <<" BCC" >>)),
1419- ? assertMatch ({array , _ }, rabbit_misc :table_lookup (Headers3 , <<" x-death" >>)).
1420+ {array , [{table , Death }]} = rabbit_misc :table_lookup (Headers3 , <<" x-death" >>),
1421+ {array , RKeys0 } = rabbit_misc :table_lookup (Death , <<" routing-keys" >>),
1422+ RKeys = [RKey || {longstr , RKey } <- RKeys0 ],
1423+ % % routing-keys in the death history should include CC but exclude BCC keys
1424+ ? assertEqual (lists :sort ([QName , <<" cc 1" >>, <<" cc 2" >>]),
1425+ lists :sort (RKeys )).
14201426
14211427% % Three top-level headers are added for the very first dead-lettering event.
14221428% % They are
@@ -1681,7 +1687,11 @@ stream(Config) ->
16811687 # 'basic.publish' {routing_key = Q1 },
16821688 # amqp_msg {payload = Payload ,
16831689 props = # 'P_basic' {expiration = <<" 0" >>,
1684- headers = [{<<" CC" >>, array , [{longstr , <<" other key" >>}]}]}
1690+ headers = [{<<" CC" >>, array , [{longstr , <<" cc 1" >>},
1691+ {longstr , <<" cc 2" >>}]},
1692+ {<<" BCC" >>, array , [{longstr , <<" bcc 1" >>},
1693+ {longstr , <<" bcc 2" >>}]}
1694+ ]}
16851695 }),
16861696
16871697 # 'basic.qos_ok' {} = amqp_channel :call (Ch1 , # 'basic.qos' {prefetch_count = 1 }),
@@ -1722,7 +1732,10 @@ stream(Config) ->
17221732 ? assertEqual ({longstr , Reason }, rabbit_misc :table_lookup (Death1 , <<" reason" >>)),
17231733 ? assertEqual ({longstr , <<>>}, rabbit_misc :table_lookup (Death1 , <<" exchange" >>)),
17241734 ? assertEqual ({long , 1 }, rabbit_misc :table_lookup (Death1 , <<" count" >>)),
1725- ? assertEqual ({array , [{longstr , Q1 }, {longstr , <<" other key" >>}]},
1735+ % % routing-keys in the death history should include CC but exclude BCC keys
1736+ ? assertEqual ({array , [{longstr , Q1 },
1737+ {longstr , <<" cc 1" >>},
1738+ {longstr , <<" cc 2" >>}]},
17261739 rabbit_misc :table_lookup (Death1 , <<" routing-keys" >>)),
17271740 ? assertEqual ({longstr , <<" 0" >>}, rabbit_misc :table_lookup (Death1 , <<" original-expiration" >>)),
17281741 {timestamp , T1 } = rabbit_misc :table_lookup (Death1 , <<" time" >>),
0 commit comments