mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
934 B
28 lines
934 B
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
namespace Volo.Abp.AzureServiceBus;
|
|
|
|
public class AzureServiceBusMessageConsumerFactory : IAzureServiceBusMessageConsumerFactory, ISingletonDependency, IDisposable
|
|
{
|
|
protected IServiceScope ServiceScope { get; }
|
|
|
|
public AzureServiceBusMessageConsumerFactory(IServiceScopeFactory serviceScopeFactory)
|
|
{
|
|
ServiceScope = serviceScopeFactory.CreateScope();
|
|
}
|
|
|
|
public IAzureServiceBusMessageConsumer CreateMessageConsumer(string topicName, string subscriptionName, string? connectionName)
|
|
{
|
|
var processor = ServiceScope.ServiceProvider.GetRequiredService<AzureServiceBusMessageConsumer>();
|
|
processor.Initialize(topicName, subscriptionName, connectionName);
|
|
return processor;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
ServiceScope?.Dispose();
|
|
}
|
|
}
|
|
|