@@ -88,6 +88,9 @@ public async Task TestRecoverTopologyOnDisposedChannel()
88
88
[ Fact ]
89
89
public async Task TestTopologyRecoveryQueueFilter ( )
90
90
{
91
+ string queueToRecover = GenerateQueueName ( ) ;
92
+ string queueToIgnore = GenerateQueueName ( ) + "-filtered.queue" ;
93
+
91
94
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
92
95
93
96
var filter = new TopologyRecoveryFilter
@@ -99,8 +102,6 @@ public async Task TestTopologyRecoveryQueueFilter()
99
102
conn . RecoverySucceeded += ( source , ea ) => tcs . SetResult ( true ) ;
100
103
IChannel ch = await conn . CreateChannelAsync ( ) ;
101
104
102
- string queueToRecover = "recovered.queue" ;
103
- string queueToIgnore = "filtered.queue" ;
104
105
await ch . QueueDeclareAsync ( queueToRecover , false , false , false ) ;
105
106
await ch . QueueDeclareAsync ( queueToIgnore , false , false , false ) ;
106
107
@@ -134,6 +135,9 @@ public async Task TestTopologyRecoveryQueueFilter()
134
135
[ Fact ]
135
136
public async Task TestTopologyRecoveryExchangeFilter ( )
136
137
{
138
+ string exchangeToRecover = GenerateExchangeName ( ) ;
139
+ string exchangeToIgnore = GenerateExchangeName ( ) + "-filtered.exchange" ;
140
+
137
141
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
138
142
139
143
var filter = new TopologyRecoveryFilter
@@ -146,8 +150,6 @@ public async Task TestTopologyRecoveryExchangeFilter()
146
150
IChannel ch = await conn . CreateChannelAsync ( ) ;
147
151
try
148
152
{
149
- string exchangeToRecover = "recovered.exchange" ;
150
- string exchangeToIgnore = "filtered.exchange" ;
151
153
await ch . ExchangeDeclareAsync ( exchangeToRecover , "topic" , false , true ) ;
152
154
await ch . ExchangeDeclareAsync ( exchangeToIgnore , "direct" , false , true ) ;
153
155
@@ -178,6 +180,12 @@ public async Task TestTopologyRecoveryExchangeFilter()
178
180
[ Fact ]
179
181
public async Task TestTopologyRecoveryBindingFilter ( )
180
182
{
183
+ string exchange = GenerateExchangeName ( ) ;
184
+ string queueWithRecoveredBinding = GenerateQueueName ( ) ;
185
+ string queueWithIgnoredBinding = GenerateQueueName ( ) ;
186
+ const string bindingToRecover = "recovered.binding" ;
187
+ const string bindingToIgnore = "filtered.binding" ;
188
+
181
189
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
182
190
183
191
var filter = new TopologyRecoveryFilter
@@ -192,12 +200,6 @@ public async Task TestTopologyRecoveryBindingFilter()
192
200
193
201
try
194
202
{
195
- string exchange = "topology.recovery.exchange" ;
196
- string queueWithRecoveredBinding = "topology.recovery.queue.1" ;
197
- string queueWithIgnoredBinding = "topology.recovery.queue.2" ;
198
- string bindingToRecover = "recovered.binding" ;
199
- string bindingToIgnore = "filtered.binding" ;
200
-
201
203
await ch . ExchangeDeclareAsync ( exchange , "direct" ) ;
202
204
await ch . QueueDeclareAsync ( queueWithRecoveredBinding , false , false , false ) ;
203
205
await ch . QueueDeclareAsync ( queueWithIgnoredBinding , false , false , false ) ;
@@ -218,6 +220,9 @@ public async Task TestTopologyRecoveryBindingFilter()
218
220
}
219
221
finally
220
222
{
223
+ await ch . ExchangeDeleteAsync ( exchange ) ;
224
+ await ch . QueueDeleteAsync ( queueWithRecoveredBinding ) ;
225
+ await ch . QueueDeleteAsync ( queueWithIgnoredBinding ) ;
221
226
await ch . CloseAsync ( ) ;
222
227
await conn . CloseAsync ( ) ;
223
228
ch . Dispose ( ) ;
@@ -228,9 +233,9 @@ public async Task TestTopologyRecoveryBindingFilter()
228
233
[ Fact ]
229
234
public async Task TestTopologyRecoveryDefaultFilterRecoversAllEntities ( )
230
235
{
231
- const string exchange = "topology.recovery.exchange" ;
232
- const string queue1 = "topology.recovery.queue.1" ;
233
- const string queue2 = "topology.recovery.queue.2" ;
236
+ string exchange = GenerateExchangeName ( ) ;
237
+ string queue1 = GenerateQueueName ( ) ;
238
+ string queue2 = GenerateQueueName ( ) ;
234
239
const string binding1 = "recovered.binding" ;
235
240
const string binding2 = "filtered.binding" ;
236
241
@@ -305,6 +310,9 @@ public async Task TestTopologyRecoveryDefaultFilterRecoversAllEntities()
305
310
[ Fact ]
306
311
public async Task TestTopologyRecoveryQueueExceptionHandler ( )
307
312
{
313
+ string queueToRecoverWithException = GenerateQueueName ( ) + "-recovery.exception.queue" ;
314
+ string queueToRecoverSuccessfully = GenerateQueueName ( ) + "-successfully.recovered.queue" ;
315
+
308
316
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
309
317
310
318
var changedQueueArguments = new Dictionary < string , object >
@@ -335,8 +343,6 @@ await channel.QueueDeclareAsync(rq.Name, false, false, false,
335
343
conn . RecoverySucceeded += ( source , ea ) => tcs . SetResult ( true ) ;
336
344
IChannel ch = await conn . CreateChannelAsync ( ) ;
337
345
338
- string queueToRecoverWithException = "recovery.exception.queue" ;
339
- string queueToRecoverSuccessfully = "successfully.recovered.queue" ;
340
346
await ch . QueueDeclareAsync ( queueToRecoverWithException , false , false , false ) ;
341
347
await ch . QueueDeclareAsync ( queueToRecoverSuccessfully , false , false , false ) ;
342
348
@@ -367,6 +373,9 @@ await _channel.QueueDeclareAsync(queueToRecoverWithException, false, false, fals
367
373
[ Fact ]
368
374
public async Task TestTopologyRecoveryExchangeExceptionHandler ( )
369
375
{
376
+ string exchangeToRecoverWithException = GenerateExchangeName ( ) + "-recovery.exception.exchange" ;
377
+ string exchangeToRecoverSuccessfully = GenerateExchangeName ( ) + "-successfully.recovered.exchange" ;
378
+
370
379
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
371
380
372
381
var exceptionHandler = new TopologyRecoveryExceptionHandler
@@ -390,8 +399,6 @@ public async Task TestTopologyRecoveryExchangeExceptionHandler()
390
399
AutorecoveringConnection conn = await CreateAutorecoveringConnectionWithTopologyRecoveryExceptionHandlerAsync ( exceptionHandler ) ;
391
400
conn . RecoverySucceeded += ( source , ea ) => tcs . SetResult ( true ) ;
392
401
393
- string exchangeToRecoverWithException = "recovery.exception.exchange" ;
394
- string exchangeToRecoverSuccessfully = "successfully.recovered.exchange" ;
395
402
IChannel ch = await conn . CreateChannelAsync ( ) ;
396
403
await ch . ExchangeDeclareAsync ( exchangeToRecoverWithException , "direct" , false , false ) ;
397
404
await ch . ExchangeDeclareAsync ( exchangeToRecoverSuccessfully , "direct" , false , false ) ;
@@ -423,12 +430,12 @@ public async Task TestTopologyRecoveryExchangeExceptionHandler()
423
430
[ Fact ]
424
431
public async Task TestTopologyRecoveryBindingExceptionHandler ( )
425
432
{
426
- var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
427
-
428
- const string exchange = "topology.recovery.exchange" ;
429
- const string queueWithExceptionBinding = "recovery.exception.queue" ;
433
+ string exchange = GenerateExchangeName ( ) ;
434
+ string queueWithExceptionBinding = GenerateQueueName ( ) ;
430
435
const string bindingToRecoverWithException = "recovery.exception.binding" ;
431
436
437
+ var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
438
+
432
439
var exceptionHandler = new TopologyRecoveryExceptionHandler
433
440
{
434
441
BindingRecoveryExceptionCondition = ( b , ex ) =>
@@ -484,9 +491,9 @@ public async Task TestTopologyRecoveryBindingExceptionHandler()
484
491
[ Fact ]
485
492
public async Task TestTopologyRecoveryConsumerExceptionHandler ( )
486
493
{
487
- var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
494
+ string queueWithExceptionConsumer = GenerateQueueName ( ) + "-recovery.exception.queue" ;
488
495
489
- string queueWithExceptionConsumer = "recovery.exception.queue" ;
496
+ var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
490
497
491
498
var exceptionHandler = new TopologyRecoveryExceptionHandler
492
499
{
0 commit comments