@@ -1331,52 +1331,54 @@ dead_letter_headers_should_be_appended_for_each_event(Config) ->
13311331
13321332dead_letter_headers_should_not_be_appended_for_republish (Config ) ->
13331333 % % here we (re-)publish a message with the DL headers already set
1334- {Conn , Ch } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 0 ),
1334+ {Conn0 , Ch0 } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 0 ),
1335+ {Conn1 , Ch1 } = rabbit_ct_client_helpers :open_connection_and_channel (Config , 1 ),
13351336 Args = ? config (queue_args , Config ),
13361337 Durable = ? config (queue_durable , Config ),
13371338 QName = ? config (queue_name , Config ),
13381339 DlxName = ? config (queue_name_dlx , Config ),
13391340
13401341 DeadLetterArgs = [{<<" x-dead-letter-exchange" >>, longstr , <<>>},
13411342 {<<" x-dead-letter-routing-key" >>, longstr , DlxName }],
1342- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs ++ Args , durable = Durable }),
1343- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = DlxName , arguments = Args , durable = Durable }),
1343+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs ++ Args , durable = Durable }),
1344+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = DlxName , arguments = Args , durable = Durable }),
13441345
13451346 P = <<" msg1" >>,
13461347
13471348 % % Publish message
1348- publish (Ch , QName , [P ]),
1349+ publish (Ch0 , QName , [P ]),
13491350 wait_for_messages (Config , [[QName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
1350- [DTag ] = consume (Ch , QName , [P ]),
1351+ [DTag ] = consume (Ch0 , QName , [P ]),
13511352 wait_for_messages (Config , [[QName , <<" 1" >>, <<" 0" >>, <<" 1" >>]]),
1352- amqp_channel :cast (Ch , # 'basic.nack' {delivery_tag = DTag ,
1353- multiple = false ,
1354- requeue = false }),
1353+ amqp_channel :cast (Ch0 , # 'basic.nack' {delivery_tag = DTag ,
1354+ multiple = false ,
1355+ requeue = false }),
13551356 wait_for_messages (Config , [[DlxName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
13561357 {# 'basic.get_ok' {delivery_tag = DTag1 }, # amqp_msg {payload = P ,
13571358 props = # 'P_basic' {headers = Headers1 }}} =
1358- amqp_channel :call (Ch , # 'basic.get' {queue = DlxName }),
1359+ amqp_channel :call (Ch0 , # 'basic.get' {queue = DlxName }),
13591360 {array , [{table , Death1 }]} = rabbit_misc :table_lookup (Headers1 , <<" x-death" >>),
13601361 ? assertEqual ({longstr , <<" rejected" >>}, rabbit_misc :table_lookup (Death1 , <<" reason" >>)),
13611362
1362- amqp_channel :cast (Ch , # 'basic.ack' {delivery_tag = DTag1 }),
1363+ amqp_channel :cast (Ch0 , # 'basic.ack' {delivery_tag = DTag1 }),
13631364
13641365 wait_for_messages (Config , [[DlxName , <<" 0" >>, <<" 0" >>, <<" 0" >>]]),
13651366
1366- # 'queue.delete_ok' {} = amqp_channel :call (Ch , # 'queue.delete' {queue = QName }),
1367+ # 'queue.delete_ok' {} = amqp_channel :call (Ch0 , # 'queue.delete' {queue = QName }),
13671368 DeadLetterArgs1 = DeadLetterArgs ++ [{<<" x-message-ttl" >>, long , 1 }],
1368- # 'queue.declare_ok' {} = amqp_channel :call (Ch , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs1 ++ Args , durable = Durable }),
1369+ # 'queue.declare_ok' {} = amqp_channel :call (Ch0 , # 'queue.declare' {queue = QName , arguments = DeadLetterArgs1 ++ Args , durable = Durable }),
13691370
1370- publish (Ch , QName , [P ], Headers1 ),
1371+ publish (Ch1 , QName , [P ], Headers1 ),
13711372
13721373 wait_for_messages (Config , [[DlxName , <<" 1" >>, <<" 1" >>, <<" 0" >>]]),
13731374 {# 'basic.get_ok' {}, # amqp_msg {payload = P ,
13741375 props = # 'P_basic' {headers = Headers2 }}} =
1375- amqp_channel :call (Ch , # 'basic.get' {queue = DlxName }),
1376+ amqp_channel :call (Ch0 , # 'basic.get' {queue = DlxName }),
13761377
13771378 {array , [{table , Death2 }]} = rabbit_misc :table_lookup (Headers2 , <<" x-death" >>),
13781379 ? assertEqual ({longstr , <<" expired" >>}, rabbit_misc :table_lookup (Death2 , <<" reason" >>)),
1379- ok = rabbit_ct_client_helpers :close_connection (Conn ).
1380+ ok = rabbit_ct_client_helpers :close_connection (Conn0 ),
1381+ ok = rabbit_ct_client_helpers :close_connection (Conn1 ).
13801382
13811383% % Dead-lettering a message modifies its headers:
13821384% % the exchange name is replaced with that of the latest dead-letter exchange,
0 commit comments