@@ -744,10 +744,17 @@ public void TestRecoveringConsumerHandlerOnConnection()
744744 [ Test ]
745745 public void TestRecoveringConsumerHandlerOnConnection_EventArgumentsArePassedDown ( )
746746 {
747- var myArgs = new Dictionary < string , object > { { "first-argument" , "some-value" } } ;
747+ const string key = "first-argument" ;
748+ const string value = "some-value" ;
749+
750+ IDictionary < string , object > arguments = new Dictionary < string , object >
751+ {
752+ { key , value }
753+ } ;
754+
748755 string q = Model . QueueDeclare ( GenerateQueueName ( ) , false , false , false , null ) . QueueName ;
749756 var cons = new EventingBasicConsumer ( Model ) ;
750- string expectedCTag = Model . BasicConsume ( cons , q , arguments : myArgs ) ;
757+ string expectedCTag = Model . BasicConsume ( cons , q , arguments : arguments ) ;
751758
752759 bool ctagMatches = false ;
753760 bool consumerArgumentMatches = false ;
@@ -757,14 +764,15 @@ public void TestRecoveringConsumerHandlerOnConnection_EventArgumentsArePassedDow
757764 // passed to a CallbackExceptionHandler, instead of failing the test. Instead, we have to do this trick
758765 // and assert in the test function.
759766 ctagMatches = args . ConsumerTag == expectedCTag ;
760- consumerArgumentMatches = ( string ) args . ConsumerArguments [ "first-argument" ] == "some-value" ;
761- args . ConsumerArguments [ "first-argument" ] = "event-handler-set-this-value" ;
767+ consumerArgumentMatches = ( string ) args . ConsumerArguments [ key ] == value ;
762768 } ;
763769
764770 CloseAndWaitForRecovery ( ) ;
765771 Assert . That ( ctagMatches , Is . True , "expected consumer tag to match" ) ;
766772 Assert . That ( consumerArgumentMatches , Is . True , "expected consumer arguments to match" ) ;
767- Assert . That ( myArgs , Does . ContainKey ( "first-argument" ) . WithValue ( "event-handler-set-this-value" ) ) ;
773+ Assert . That ( arguments . ContainsKey ( key ) , Is . True ) ;
774+ string actualVal = ( string ) arguments [ key ] ;
775+ Assert . That ( actualVal , Is . EqualTo ( value ) ) ;
768776 }
769777
770778 [ Test ]
@@ -1687,6 +1695,51 @@ void MessageReceived(object sender, BasicDeliverEventArgs e)
16871695 }
16881696 }
16891697
1698+ [ Test ]
1699+ public void TestQueueRecoveryWithDlxArgument_RabbitMQUsers_hk5pJ4cKF0c ( )
1700+ {
1701+ string tdiWaitExchangeName = GenerateExchangeName ( ) ;
1702+ string tdiRetryExchangeName = GenerateExchangeName ( ) ;
1703+ string testRetryQueueName = GenerateQueueName ( ) ;
1704+ string testQueueName = GenerateQueueName ( ) ;
1705+
1706+ Model . ExchangeDeclare ( exchange : tdiWaitExchangeName ,
1707+ type : ExchangeType . Topic , durable : true , autoDelete : false , arguments : null ) ;
1708+ Model . ExchangeDeclare ( exchange : tdiRetryExchangeName ,
1709+ type : ExchangeType . Topic , durable : true , autoDelete : false , arguments : null ) ;
1710+
1711+ var arguments = new Dictionary < string , object >
1712+ {
1713+ { "x-dead-letter-exchange" , "tdi.retry.exchange" } ,
1714+ { "x-dead-letter-routing-key" , "QueueTest" }
1715+ } ;
1716+
1717+ Model . QueueDeclare ( testRetryQueueName , durable : false , exclusive : false , autoDelete : false , arguments ) ;
1718+
1719+ arguments [ "x-dead-letter-exchange" ] = "tdi.wait.exchange" ;
1720+ arguments [ "x-dead-letter-routing-key" ] = "QueueTest" ;
1721+
1722+ Model . QueueDeclare ( testQueueName , durable : false , exclusive : false , autoDelete : false , arguments ) ;
1723+
1724+ arguments . Remove ( "x-dead-letter-exchange" ) ;
1725+ arguments . Remove ( "x-dead-letter-routing-key" ) ;
1726+
1727+ Model . QueueBind ( testRetryQueueName , tdiWaitExchangeName , testQueueName ) ;
1728+
1729+ Model . QueueBind ( testQueueName , tdiRetryExchangeName , testQueueName ) ;
1730+
1731+ var consumerAsync = new EventingBasicConsumer ( Model ) ;
1732+ Model . BasicConsume ( queue : testQueueName , autoAck : false , consumer : consumerAsync ) ;
1733+
1734+ CloseAndWaitForRecovery ( ) ;
1735+
1736+ QueueDeclareOk q0 = Model . QueueDeclarePassive ( testRetryQueueName ) ;
1737+ Assert . AreEqual ( testRetryQueueName , q0 . QueueName ) ;
1738+
1739+ QueueDeclareOk q1 = Model . QueueDeclarePassive ( testQueueName ) ;
1740+ Assert . AreEqual ( testQueueName , q1 . QueueName ) ;
1741+ }
1742+
16901743 internal bool SendAndConsumeMessage ( string queue , string exchange , string routingKey )
16911744 {
16921745 using ( var ch = Conn . CreateModel ( ) )
0 commit comments