@@ -1379,17 +1379,18 @@ dead_letter_headers_BCC(Config) ->
1379
1379
routing_key = DLXQName }),
1380
1380
1381
1381
P1 = <<" msg1" >>,
1382
- BCCHeader = {<<" BCC" >>, array , [{longstr , DLXQName }]},
1383
- publish (Ch , QName , [P1 ], [BCCHeader ]),
1382
+ CCHeader = {<<" CC" >>, array , [{longstr , <<" cc 1" >>}, {longstr , <<" cc 2" >>}]},
1383
+ BCCHeader = {<<" BCC" >>, array , [{longstr , DLXQName }, {longstr , <<" bcc 2" >>}]},
1384
+ publish (Ch , QName , [P1 ], [CCHeader , BCCHeader ]),
1384
1385
% % Message is published to both queues because of BCC header and DLX queue bound to both
1385
1386
% % exchanges
1386
1387
wait_for_messages (Config , [[QName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
1387
1388
{# 'basic.get_ok' {delivery_tag = DTag1 }, # amqp_msg {payload = P1 ,
1388
1389
props = # 'P_basic' {headers = Headers1 }}} =
1389
- amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
1390
+ amqp_channel :call (Ch , # 'basic.get' {queue = QName }),
1390
1391
{# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
1391
1392
props = # 'P_basic' {headers = Headers2 }}} =
1392
- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1393
+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1393
1394
% % We check the headers to ensure no dead lettering has happened
1394
1395
? assertEqual (undefined , header_lookup (Headers1 , <<" x-death" >>)),
1395
1396
? assertEqual (undefined , header_lookup (Headers2 , <<" x-death" >>)),
@@ -1401,10 +1402,15 @@ dead_letter_headers_BCC(Config) ->
1401
1402
wait_for_messages (Config , [[DLXQName , <<" 2" >>, <<" 1" >>, <<" 1" >>]]),
1402
1403
{# 'basic.get_ok' {}, # amqp_msg {payload = P1 ,
1403
1404
props = # 'P_basic' {headers = Headers3 }}} =
1404
- amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1405
+ amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName }),
1405
1406
consume_empty (Ch , QName ),
1406
1407
? assertEqual (undefined , rabbit_misc :table_lookup (Headers3 , <<" BCC" >>)),
1407
- ? assertMatch ({array , _ }, rabbit_misc :table_lookup (Headers3 , <<" x-death" >>)).
1408
+ {array , [{table , Death }]} = rabbit_misc :table_lookup (Headers3 , <<" x-death" >>),
1409
+ {array , RKeys0 } = rabbit_misc :table_lookup (Death , <<" routing-keys" >>),
1410
+ RKeys = [RKey || {longstr , RKey } <- RKeys0 ],
1411
+ % % routing-keys in the death history should include CC but exclude BCC keys
1412
+ ? assertEqual (lists :sort ([QName , <<" cc 1" >>, <<" cc 2" >>]),
1413
+ lists :sort (RKeys )).
1408
1414
1409
1415
% % Three top-level headers are added for the very first dead-lettering event.
1410
1416
% % They are
@@ -1669,7 +1675,11 @@ stream(Config) ->
1669
1675
# 'basic.publish' {routing_key = Q1 },
1670
1676
# amqp_msg {payload = Payload ,
1671
1677
props = # 'P_basic' {expiration = <<" 0" >>,
1672
- headers = [{<<" CC" >>, array , [{longstr , <<" other key" >>}]}]}
1678
+ headers = [{<<" CC" >>, array , [{longstr , <<" cc 1" >>},
1679
+ {longstr , <<" cc 2" >>}]},
1680
+ {<<" BCC" >>, array , [{longstr , <<" bcc 1" >>},
1681
+ {longstr , <<" bcc 2" >>}]}
1682
+ ]}
1673
1683
}),
1674
1684
1675
1685
# 'basic.qos_ok' {} = amqp_channel :call (Ch1 , # 'basic.qos' {prefetch_count = 1 }),
@@ -1710,7 +1720,10 @@ stream(Config) ->
1710
1720
? assertEqual ({longstr , Reason }, rabbit_misc :table_lookup (Death1 , <<" reason" >>)),
1711
1721
? assertEqual ({longstr , <<>>}, rabbit_misc :table_lookup (Death1 , <<" exchange" >>)),
1712
1722
? assertEqual ({long , 1 }, rabbit_misc :table_lookup (Death1 , <<" count" >>)),
1713
- ? assertEqual ({array , [{longstr , Q1 }, {longstr , <<" other key" >>}]},
1723
+ % % routing-keys in the death history should include CC but exclude BCC keys
1724
+ ? assertEqual ({array , [{longstr , Q1 },
1725
+ {longstr , <<" cc 1" >>},
1726
+ {longstr , <<" cc 2" >>}]},
1714
1727
rabbit_misc :table_lookup (Death1 , <<" routing-keys" >>)),
1715
1728
? assertEqual ({longstr , <<" 0" >>}, rabbit_misc :table_lookup (Death1 , <<" original-expiration" >>)),
1716
1729
{timestamp , T1 } = rabbit_misc :table_lookup (Death1 , <<" time" >>),
0 commit comments