@@ -1598,6 +1598,7 @@ x_death_header_from_amqpl_client(Config) ->
15981598 DLXQName = ? config (queue_name_dlx , Config ),
15991599 declare_dead_letter_queues (Ch , Config , QName , DLXQName , [{<<" x-message-ttl" >>, long , 0 }]),
16001600
1601+ Ts = os :system_time (second ),
16011602 Payload = <<" my payload" >>,
16021603 ok = amqp_channel :call (Ch ,
16031604 # 'basic.publish' {routing_key = QName },
@@ -1610,6 +1611,10 @@ x_death_header_from_amqpl_client(Config) ->
16101611 no_ack = true }),
16111612 {array , [{table , Death1 }]} = rabbit_misc :table_lookup (Headers1 , <<" x-death" >>),
16121613 ? assertEqual ({long , 1 }, rabbit_misc :table_lookup (Death1 , <<" count" >>)),
1614+ % % AMQP 0.9.1 timestamp should be seconds since epoch.
1615+ {timestamp , Ts1 } = rabbit_misc :table_lookup (Death1 , <<" time" >>),
1616+ ? assert (Ts1 > Ts - 10 ),
1617+ ? assert (Ts1 < Ts + 10 ),
16131618
16141619 ok = amqp_channel :call (Ch ,
16151620 # 'basic.publish' {routing_key = QName },
@@ -1623,7 +1628,10 @@ x_death_header_from_amqpl_client(Config) ->
16231628 } = amqp_channel :call (Ch , # 'basic.get' {queue = DLXQName ,
16241629 no_ack = true }),
16251630 {array , [{table , Death2 }]} = rabbit_misc :table_lookup (Headers2 , <<" x-death" >>),
1626- ? assertEqual ({long , 2 }, rabbit_misc :table_lookup (Death2 , <<" count" >>)).
1631+ ? assertEqual ({long , 2 }, rabbit_misc :table_lookup (Death2 , <<" count" >>)),
1632+ % % Timestamp should be exactly the same as the 1st timestamp because it denotes
1633+ % % when this message was dead lettered the **first** time from this queue for this reason.
1634+ ? assertEqual ({timestamp , Ts1 }, rabbit_misc :table_lookup (Death2 , <<" time" >>)).
16271635
16281636set_queue_options (QName , Options ) ->
16291637 rabbit_amqqueue :update (rabbit_misc :r (<<" /" >>, queue , QName ),
0 commit comments