@@ -1391,17 +1391,18 @@ dead_letter_headers_BCC(Config) ->
1391
1391
routing_key = DLXQName }),
1392
1392
1393
1393
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 ]),
1396
1397
% % Message is published to both queues because of BCC header and DLX queue bound to both
1397
1398
% % exchanges
1398
1399
wait_for_messages (Config , [[QName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
1399
1400
{# 'basic.get_ok' {delivery_tag = DTag1 }, # amqp_msg {payload = P1 ,
1400
1401
props = # 'P_basic' {headers = Headers1 }}} =
1401
- amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
1402
+ amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
1402
1403
{# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
1403
1404
props = # 'P_basic' {headers = Headers2 }}} =
1404
- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1405
+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1405
1406
% % We check the headers to ensure no dead lettering has happened
1406
1407
? assertEqual (undefined , header_lookup (Headers1 , <<" x-death" >>)),
1407
1408
? assertEqual (undefined , header_lookup (Headers2 , <<" x-death" >>)),
@@ -1413,10 +1414,15 @@ dead_letter_headers_BCC(Config) ->
1413
1414
wait_for_messages (Config , [[DLXQName , <<" 2" >>, <<" 1" >>, <<" 1" >>]]),
1414
1415
{# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
1415
1416
props = # 'P_basic' {headers = Headers3 }}} =
1416
- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1417
+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1417
1418
consume_empty (Ch , QName ),
1418
1419
? 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 )).
1420
1426
1421
1427
% % Three top-level headers are added for the very first dead-lettering event.
1422
1428
% % They are
@@ -1681,7 +1687,11 @@ stream(Config) ->
1681
1687
# 'basic.publish' {routing_key = Q1 },
1682
1688
# amqp_msg {payload = Payload ,
1683
1689
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
+ ]}
1685
1695
}),
1686
1696
1687
1697
# 'basic.qos_ok' {} = amqp_channel :call (Ch1 , # 'basic.qos' {prefetch_count = 1 }),
@@ -1722,7 +1732,10 @@ stream(Config) ->
1722
1732
? assertEqual ({longstr , Reason }, rabbit_misc :table_lookup (Death1 , <<" reason" >>)),
1723
1733
? assertEqual ({longstr , <<>>}, rabbit_misc :table_lookup (Death1 , <<" exchange" >>)),
1724
1734
? 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" >>}]},
1726
1739
rabbit_misc :table_lookup (Death1 , <<" routing-keys" >>)),
1727
1740
? assertEqual ({longstr , <<" 0" >>}, rabbit_misc :table_lookup (Death1 , <<" original-expiration" >>)),
1728
1741
{timestamp , T1 } = rabbit_misc :table_lookup (Death1 , <<" time" >>),
0 commit comments