@@ -18,7 +18,6 @@ namespace ServiceControl.Transports.RabbitMQ;
1818
1919public class RabbitMQQuery : BrokerThroughputQuery
2020{
21- readonly ILogger < RabbitMQQuery > logger ;
2221 readonly TimeProvider timeProvider ;
2322 readonly Lazy < ManagementClient > managementClient ;
2423
@@ -29,7 +28,6 @@ public class RabbitMQQuery : BrokerThroughputQuery
2928
3029 public RabbitMQQuery ( ILogger < RabbitMQQuery > logger , TimeProvider timeProvider , ITransportCustomization transportCustomization ) : base ( logger , "RabbitMQ" )
3130 {
32- this . logger = logger ;
3331 this . timeProvider = timeProvider ;
3432
3533 if ( transportCustomization is IManagementClientProvider provider )
@@ -44,20 +42,7 @@ public RabbitMQQuery(ILogger<RabbitMQQuery> logger, TimeProvider timeProvider, I
4442
4543 protected override void InitializeCore ( ReadOnlyDictionary < string , string > settings )
4644 {
47- // TODO: Update documentation
48- // https://docs.particular.net/servicecontrol/servicecontrol-instances/configuration#usage-reporting-when-using-the-rabbitmq-transport
49- CheckLegacySettings ( settings , RabbitMQSettings . UserName ) ;
50- CheckLegacySettings ( settings , RabbitMQSettings . Password ) ;
51- CheckLegacySettings ( settings , RabbitMQSettings . API ) ;
52- }
53-
54- void CheckLegacySettings ( ReadOnlyDictionary < string , string > settings , string key )
55- {
56- if ( settings . TryGetValue ( key , out _ ) )
57- {
58- logger . LogInformation ( $ "The legacy LicensingComponent/{ key } is still defined in the app.config or environment variables") ;
59- _ = Diagnostics . AppendLine ( $ "LicensingComponent/{ key } is still defined in the app.config or environment variables") ;
60- }
45+ Diagnostics . AppendLine ( "Using settings from connection string" ) ;
6146 }
6247
6348 public override async IAsyncEnumerable < QueueThroughput > GetThroughputPerDay ( IBrokerQueue brokerQueue , DateOnly startDate , [ EnumeratorCancellation ] CancellationToken cancellationToken = default )
@@ -216,12 +201,7 @@ static List<RabbitMQBrokerQueueDetails> MaterializeQueueDetails(List<Queue> item
216201 return queues ;
217202 }
218203
219- public override KeyDescriptionPair [ ] Settings =>
220- [
221- new KeyDescriptionPair ( RabbitMQSettings . API , RabbitMQSettings . APIDescription ) ,
222- new KeyDescriptionPair ( RabbitMQSettings . UserName , RabbitMQSettings . UserNameDescription ) ,
223- new KeyDescriptionPair ( RabbitMQSettings . Password , RabbitMQSettings . PasswordDescription )
224- ] ;
204+ public override KeyDescriptionPair [ ] Settings => [ ] ;
225205
226206 protected override async Task < ( bool Success , List < string > Errors ) > TestConnectionCore ( CancellationToken cancellationToken )
227207 {
@@ -243,15 +223,5 @@ static List<RabbitMQBrokerQueueDetails> MaterializeQueueDetails(List<Queue> item
243223 throw new Exception ( $ "Failed to connect to RabbitMQ management API", ex ) ;
244224 }
245225 }
246-
247- public static class RabbitMQSettings
248- {
249- public static readonly string API = "RabbitMQ/ApiUrl" ;
250- public static readonly string APIDescription = "RabbitMQ management URL" ;
251- public static readonly string UserName = "RabbitMQ/UserName" ;
252- public static readonly string UserNameDescription = "Username to access the RabbitMQ management interface" ;
253- public static readonly string Password = "RabbitMQ/Password" ;
254- public static readonly string PasswordDescription = "Password to access the RabbitMQ management interface" ;
255- }
256226}
257227
0 commit comments