@@ -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
@@ -103,8 +106,6 @@ public async Task TestTopologyRecoveryQueueFilter()
103
106
} ;
104
107
IChannel ch = await conn . CreateChannelAsync ( ) ;
105
108
106
- string queueToRecover = "recovered.queue" ;
107
- string queueToIgnore = "filtered.queue" ;
108
109
await ch . QueueDeclareAsync ( queueToRecover , false , false , false ) ;
109
110
await ch . QueueDeclareAsync ( queueToIgnore , false , false , false ) ;
110
111
@@ -138,6 +139,9 @@ public async Task TestTopologyRecoveryQueueFilter()
138
139
[ Fact ]
139
140
public async Task TestTopologyRecoveryExchangeFilter ( )
140
141
{
142
+ string exchangeToRecover = GenerateExchangeName ( ) ;
143
+ string exchangeToIgnore = GenerateExchangeName ( ) + "-filtered.exchange" ;
144
+
141
145
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
142
146
143
147
var filter = new TopologyRecoveryFilter
@@ -154,8 +158,6 @@ public async Task TestTopologyRecoveryExchangeFilter()
154
158
IChannel ch = await conn . CreateChannelAsync ( ) ;
155
159
try
156
160
{
157
- string exchangeToRecover = "recovered.exchange" ;
158
- string exchangeToIgnore = "filtered.exchange" ;
159
161
await ch . ExchangeDeclareAsync ( exchangeToRecover , "topic" , false , true ) ;
160
162
await ch . ExchangeDeclareAsync ( exchangeToIgnore , "direct" , false , true ) ;
161
163
@@ -186,6 +188,12 @@ public async Task TestTopologyRecoveryExchangeFilter()
186
188
[ Fact ]
187
189
public async Task TestTopologyRecoveryBindingFilter ( )
188
190
{
191
+ string exchange = GenerateExchangeName ( ) ;
192
+ string queueWithRecoveredBinding = GenerateQueueName ( ) ;
193
+ string queueWithIgnoredBinding = GenerateQueueName ( ) ;
194
+ const string bindingToRecover = "recovered.binding" ;
195
+ const string bindingToIgnore = "filtered.binding" ;
196
+
189
197
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
190
198
191
199
var filter = new TopologyRecoveryFilter
@@ -204,12 +212,6 @@ public async Task TestTopologyRecoveryBindingFilter()
204
212
205
213
try
206
214
{
207
- string exchange = "topology.recovery.exchange" ;
208
- string queueWithRecoveredBinding = "topology.recovery.queue.1" ;
209
- string queueWithIgnoredBinding = "topology.recovery.queue.2" ;
210
- string bindingToRecover = "recovered.binding" ;
211
- string bindingToIgnore = "filtered.binding" ;
212
-
213
215
await ch . ExchangeDeclareAsync ( exchange , "direct" ) ;
214
216
await ch . QueueDeclareAsync ( queueWithRecoveredBinding , false , false , false ) ;
215
217
await ch . QueueDeclareAsync ( queueWithIgnoredBinding , false , false , false ) ;
@@ -230,6 +232,9 @@ public async Task TestTopologyRecoveryBindingFilter()
230
232
}
231
233
finally
232
234
{
235
+ await ch . ExchangeDeleteAsync ( exchange ) ;
236
+ await ch . QueueDeleteAsync ( queueWithRecoveredBinding ) ;
237
+ await ch . QueueDeleteAsync ( queueWithIgnoredBinding ) ;
233
238
await ch . CloseAsync ( ) ;
234
239
await conn . CloseAsync ( ) ;
235
240
ch . Dispose ( ) ;
@@ -240,9 +245,9 @@ public async Task TestTopologyRecoveryBindingFilter()
240
245
[ Fact ]
241
246
public async Task TestTopologyRecoveryDefaultFilterRecoversAllEntities ( )
242
247
{
243
- const string exchange = "topology.recovery.exchange" ;
244
- const string queue1 = "topology.recovery.queue.1" ;
245
- const string queue2 = "topology.recovery.queue.2" ;
248
+ string exchange = GenerateExchangeName ( ) ;
249
+ string queue1 = GenerateQueueName ( ) ;
250
+ string queue2 = GenerateQueueName ( ) ;
246
251
const string binding1 = "recovered.binding" ;
247
252
const string binding2 = "filtered.binding" ;
248
253
@@ -329,6 +334,9 @@ public async Task TestTopologyRecoveryDefaultFilterRecoversAllEntities()
329
334
[ Fact ]
330
335
public async Task TestTopologyRecoveryQueueExceptionHandler ( )
331
336
{
337
+ string queueToRecoverWithException = GenerateQueueName ( ) + "-recovery.exception.queue" ;
338
+ string queueToRecoverSuccessfully = GenerateQueueName ( ) + "-successfully.recovered.queue" ;
339
+
332
340
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
333
341
334
342
var changedQueueArguments = new Dictionary < string , object >
@@ -363,8 +371,6 @@ await channel.QueueDeclareAsync(rq.Name, false, false, false,
363
371
} ;
364
372
IChannel ch = await conn . CreateChannelAsync ( ) ;
365
373
366
- string queueToRecoverWithException = "recovery.exception.queue" ;
367
- string queueToRecoverSuccessfully = "successfully.recovered.queue" ;
368
374
await ch . QueueDeclareAsync ( queueToRecoverWithException , false , false , false ) ;
369
375
await ch . QueueDeclareAsync ( queueToRecoverSuccessfully , false , false , false ) ;
370
376
@@ -395,6 +401,9 @@ await _channel.QueueDeclareAsync(queueToRecoverWithException, false, false, fals
395
401
[ Fact ]
396
402
public async Task TestTopologyRecoveryExchangeExceptionHandler ( )
397
403
{
404
+ string exchangeToRecoverWithException = GenerateExchangeName ( ) + "-recovery.exception.exchange" ;
405
+ string exchangeToRecoverSuccessfully = GenerateExchangeName ( ) + "-successfully.recovered.exchange" ;
406
+
398
407
var tcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
399
408
400
409
var exceptionHandler = new TopologyRecoveryExceptionHandler
@@ -422,8 +431,6 @@ public async Task TestTopologyRecoveryExchangeExceptionHandler()
422
431
return Task . CompletedTask ;
423
432
} ;
424
433
425
- string exchangeToRecoverWithException = "recovery.exception.exchange" ;
426
- string exchangeToRecoverSuccessfully = "successfully.recovered.exchange" ;
427
434
IChannel ch = await conn . CreateChannelAsync ( ) ;
428
435
await ch . ExchangeDeclareAsync ( exchangeToRecoverWithException , "direct" , false , false ) ;
429
436
await ch . ExchangeDeclareAsync ( exchangeToRecoverSuccessfully , "direct" , false , false ) ;
@@ -455,12 +462,12 @@ public async Task TestTopologyRecoveryExchangeExceptionHandler()
455
462
[ Fact ]
456
463
public async Task TestTopologyRecoveryBindingExceptionHandler ( )
457
464
{
458
- var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
459
-
460
- const string exchange = "topology.recovery.exchange" ;
461
- const string queueWithExceptionBinding = "recovery.exception.queue" ;
465
+ string exchange = GenerateExchangeName ( ) ;
466
+ string queueWithExceptionBinding = GenerateQueueName ( ) ;
462
467
const string bindingToRecoverWithException = "recovery.exception.binding" ;
463
468
469
+ var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
470
+
464
471
var exceptionHandler = new TopologyRecoveryExceptionHandler
465
472
{
466
473
BindingRecoveryExceptionCondition = ( b , ex ) =>
@@ -520,9 +527,9 @@ public async Task TestTopologyRecoveryBindingExceptionHandler()
520
527
[ Fact ]
521
528
public async Task TestTopologyRecoveryConsumerExceptionHandler ( )
522
529
{
523
- var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
530
+ string queueWithExceptionConsumer = GenerateQueueName ( ) + "-recovery.exception.queue" ;
524
531
525
- string queueWithExceptionConsumer = "recovery.exception.queue" ;
532
+ var connectionRecoveryTcs = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
526
533
527
534
var exceptionHandler = new TopologyRecoveryExceptionHandler
528
535
{
0 commit comments