@@ -1327,52 +1327,54 @@ dead_letter_headers_should_be_appended_for_each_event(Config) ->
13271327
13281328dead_letter_headers_should_not_be_appended_for_republish (Config ) ->
13291329 % % here we (re-)publish a message with the DL headers already set
1330- {Conn , Ch } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 0 ),
1330+ {Conn0 , Ch0 } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 0 ),
1331+ {Conn1 , Ch1 } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 1 ),
13311332 Args = ? config (queue_args , Config ),
13321333 Durable = ? config (queue_durable , Config ),
13331334 QName = ? config (queue_name , Config ),
13341335 DlxName = ? config (queue_name_dlx , Config ),
13351336
13361337 DeadLetterArgs = [{<<" x-dead-letter-exchange" >>, longstr , <<>>},
13371338 {<<" x-dead-letter-routing-key" >>, longstr , DlxName }],
1338- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs ++ Args , durable = Durable }),
1339- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = DlxName , arguments = Args , durable = Durable }),
1339+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs ++ Args , durable = Durable }),
1340+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = DlxName , arguments = Args , durable = Durable }),
13401341
13411342 P = <<" msg1" >>,
13421343
13431344 % % Publish message
1344- publish (Ch , QName , [P ]),
1345+ publish (Ch0 , QName , [P ]),
13451346 wait_for_messages (Config , [[QName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
1346- [DTag ] = consume (Ch , QName , [P ]),
1347+ [DTag ] = consume (Ch0 , QName , [P ]),
13471348 wait_for_messages (Config , [[QName , <<" 1" >>, <<" 0" >>, <<" 1" >>]]),
1348- amqp_channel :cast (Ch , # 'basic.nack' {delivery_tag = DTag ,
1349- multiple = false ,
1350- requeue = false }),
1349+ amqp_channel :cast (Ch0 , # 'basic.nack' {delivery_tag = DTag ,
1350+ multiple = false ,
1351+ requeue = false }),
13511352 wait_for_messages (Config , [[DlxName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
13521353 {# 'basic.get_ok' {delivery_tag = DTag1 }, # amqp_msg {payload = P ,
13531354 props = # 'P_basic' {headers = Headers1 }}} =
1354- amqp_channel :call (Ch , # 'basic.get' {queue = DlxName }),
1355+ amqp_channel :call (Ch0 , # 'basic.get' {queue = DlxName }),
13551356 {array , [{table , Death1 }]} = rabbit_misc :table_lookup (Headers1 , <<" x-death" >>),
13561357 ? assertEqual ({longstr , <<" rejected" >>}, rabbit_misc :table_lookup (Death1 , <<" reason" >>)),
13571358
1358- amqp_channel :cast (Ch , # 'basic.ack' {delivery_tag = DTag1 }),
1359+ amqp_channel :cast (Ch0 , # 'basic.ack' {delivery_tag = DTag1 }),
13591360
13601361 wait_for_messages (Config , [[DlxName , <<" 0" >>, <<" 0" >>, <<" 0" >>]]),
13611362
1362- # 'queue.delete_ok' {} = amqp_channel :call (Ch , # 'queue.delete' {queue = QName }),
1363+ # 'queue.delete_ok' {} = amqp_channel :call (Ch0 , # 'queue.delete' {queue = QName }),
13631364 DeadLetterArgs1 = DeadLetterArgs ++ [{<<" x-message-ttl" >>, long , 1 }],
1364- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs1 ++ Args , durable = Durable }),
1365+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs1 ++ Args , durable = Durable }),
13651366
1366- publish (Ch , QName , [P ], Headers1 ),
1367+ publish (Ch1 , QName , [P ], Headers1 ),
13671368
13681369 wait_for_messages (Config , [[DlxName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
13691370 {# 'basic.get_ok' {}, # amqp_msg {payload = P ,
13701371 props = # 'P_basic' {headers = Headers2 }}} =
1371- amqp_channel :call (Ch , # 'basic.get' {queue = DlxName }),
1372+ amqp_channel :call (Ch0 , # 'basic.get' {queue = DlxName }),
13721373
13731374 {array , [{table , Death2 }]} = rabbit_misc :table_lookup (Headers2 , <<" x-death" >>),
13741375 ? assertEqual ({longstr , <<" expired" >>}, rabbit_misc :table_lookup (Death2 , <<" reason" >>)),
1375- ok = rabbit_ct_client_helpers :close_connection (Conn ).
1376+ ok = rabbit_ct_client_helpers :close_connection (Conn0 ),
1377+ ok = rabbit_ct_client_helpers :close_connection (Conn1 ).
13761378
13771379% % Dead-lettering a message modifies its headers:
13781380% % the exchange name is replaced with that of the latest dead-letter exchange,
0 commit comments