@@ -27,14 +27,21 @@ public void Configure(HealthCheckServiceOptions options)
2727 return ;
2828 }
2929
30- var commonConnectionString = _serviceBusOptions . Value . Settings . ConnectionSettings ? . ConnectionString ;
30+ var commonSettings = _serviceBusOptions . Value . Settings . ConnectionSettings ;
31+ var commonConnectionString = commonSettings ? . ConnectionString ;
32+ var commonFullyQualifiedNamespace = commonSettings ? . FullyQualifiedNamespace ;
33+ var commonCredentials = commonSettings ? . Credentials ;
34+
3135 var resources = _serviceBusOptions . Value . Receivers . Union ( _serviceBusOptions . Value . Senders ) . Distinct ( )
3236 . ToArray ( ) ;
3337
3438 foreach ( var resourceGroup in resources . GroupBy ( o => o . ConnectionSettings , new ConnectionSettingsComparer ( ) ) )
3539 {
3640 var connectionString = resourceGroup . Key ? . ConnectionString ?? commonConnectionString ;
37- if ( connectionString == null )
41+ var fullyQualifiedNamespace = resourceGroup . Key ? . FullyQualifiedNamespace ?? commonFullyQualifiedNamespace ;
42+ var credentials = resourceGroup . Key ? . Credentials ?? commonCredentials ;
43+
44+ if ( connectionString == null && fullyQualifiedNamespace == null && credentials == null )
3845 {
3946 continue ;
4047 }
@@ -46,7 +53,9 @@ public void Configure(HealthCheckServiceOptions options)
4653 options . Registrations . Add ( new HealthCheckRegistration ( $ "Queue:{ group . Key } ",
4754 sp => ( IHealthCheck ) new AzureServiceBusQueueHealthCheck ( new AzureServiceBusQueueHealthCheckOptions ( group . Key )
4855 {
49- ConnectionString = connectionString
56+ ConnectionString = connectionString ,
57+ FullyQualifiedNamespace = fullyQualifiedNamespace ,
58+ Credential = credentials
5059 } ) ,
5160 null , HealthChecksBuilderExtensions . HealthCheckTags , null ) ) ;
5261 }
@@ -58,7 +67,9 @@ public void Configure(HealthCheckServiceOptions options)
5867 options . Registrations . Add ( new HealthCheckRegistration ( $ "Topic:{ group . Key } ",
5968 sp => ( IHealthCheck ) new AzureServiceBusTopicHealthCheck ( new AzureServiceBusTopicHealthCheckOptions ( group . Key )
6069 {
61- ConnectionString = connectionString
70+ ConnectionString = connectionString ,
71+ FullyQualifiedNamespace = fullyQualifiedNamespace ,
72+ Credential = credentials ,
6273 } ) ,
6374 null , HealthChecksBuilderExtensions . HealthCheckTags , null ) ) ;
6475 }
@@ -73,7 +84,9 @@ public void Configure(HealthCheckServiceOptions options)
7384 options . Registrations . Add ( new HealthCheckRegistration ( $ "Subscription:{ group . Key . TopicName } /Subscriptions/{ group . Key . SubscriptionName } ",
7485 sp => ( IHealthCheck ) new AzureServiceBusSubscriptionHealthCheck ( new AzureServiceBusSubscriptionHealthCheckHealthCheckOptions ( group . Key . TopicName , group . Key . SubscriptionName )
7586 {
76- ConnectionString = connectionString
87+ ConnectionString = connectionString ,
88+ FullyQualifiedNamespace = fullyQualifiedNamespace ,
89+ Credential = credentials
7790 } ) ,
7891 null , HealthChecksBuilderExtensions . HealthCheckTags , null ) ) ;
7992 }
0 commit comments