@@ -12,14 +12,13 @@ namespace ServiceControl.Transports.RabbitMQ;
1212using System . Threading . Tasks ;
1313using Microsoft . Extensions . Logging ;
1414using NServiceBus ;
15+ using NServiceBus . Transport . RabbitMQ . ManagementApi ;
1516using Polly ;
1617using Polly . Retry ;
1718using ServiceControl . Transports . BrokerThroughput ;
18- using NServiceBus . Transport . RabbitMQ . ManagementApi ;
1919
2020public class RabbitMQQuery : BrokerThroughputQuery
2121{
22- HttpClient ? httpClient ;
2322 readonly ResiliencePipeline pipeline = new ResiliencePipelineBuilder ( )
2423 . AddRetry ( new RetryStrategyOptions ( ) ) // Add retry using the default options
2524 . AddTimeout ( TimeSpan . FromMinutes ( 2 ) ) // Add timeout if it keeps failing
@@ -93,7 +92,7 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
9392 //logger.LogDebug($"Querying {url}");
9493 response = await pipeline . ExecuteAsync ( async token => await rabbitMQTransport . ManagementClient . GetQueue ( queue . QueueName , cancellationToken ) , cancellationToken ) ;
9594
96- if ( response . Value is not null )
95+ if ( response . Value is null )
9796 {
9897 throw new InvalidOperationException ( $ "Could not access RabbitMQ Management API. ({ response . StatusCode } : { response . Reason } )") ;
9998 }
@@ -251,7 +250,7 @@ static List<RabbitMQBrokerQueueDetails> MaterializeQueueDetails(List<Queue> item
251250 }
252251 catch ( HttpRequestException e )
253252 {
254- throw new Exception ( $ "Failed to connect to ' { httpClient ! . BaseAddress } ' ", e ) ;
253+ throw new Exception ( $ "Failed to connect to management API ", e ) ;
255254 }
256255
257256 return ( true , [ ] ) ;
0 commit comments