Browse Source
Merge pull request #11901 from wocar/AzureServiceBusEnabled
Add option to disable service bus
pull/12029/head
maliming
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
4 deletions
-
framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpAzureEventBusOptions.cs
-
framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AbpEventBusAzureModule.cs
|
|
|
@ -7,4 +7,6 @@ public class AbpAzureEventBusOptions |
|
|
|
public string SubscriberName { get; set; } |
|
|
|
|
|
|
|
public string TopicName { get; set; } |
|
|
|
|
|
|
|
public bool IsServiceBusDisabled { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.AzureServiceBus; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
|
|
@ -19,9 +20,15 @@ public class AbpEventBusAzureModule : AbpModule |
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
context |
|
|
|
.ServiceProvider |
|
|
|
.GetRequiredService<AzureDistributedEventBus>() |
|
|
|
.Initialize(); |
|
|
|
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpAzureEventBusOptions>>().Value; |
|
|
|
|
|
|
|
if (!options.IsServiceBusDisabled) |
|
|
|
{ |
|
|
|
context |
|
|
|
.ServiceProvider |
|
|
|
.GetRequiredService<AzureDistributedEventBus>() |
|
|
|
.Initialize(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|