@@ -39,7 +39,7 @@ namespace Microsoft.Extensions.DependencyInjection | |||||
services.TryAddSingleton<ICapPublisher, CapPublisher>(); | services.TryAddSingleton<ICapPublisher, CapPublisher>(); | ||||
services.TryAddSingleton<IConsumerServiceSelector, ConsumerServiceSelector>(); | services.TryAddSingleton<IConsumerServiceSelector, ConsumerServiceSelector>(); | ||||
services.TryAddSingleton<ISubscribeInvokerFactory, ConsumerInvokerFactory>(); | |||||
services.TryAddSingleton<ISubscribeInvoker, SubscribeInvoker>(); | |||||
services.TryAddSingleton<MethodMatcherCache>(); | services.TryAddSingleton<MethodMatcherCache>(); | ||||
services.TryAddSingleton<IConsumerRegister, ConsumerRegister>(); | services.TryAddSingleton<IConsumerRegister, ConsumerRegister>(); | ||||
@@ -1,27 +0,0 @@ | |||||
// Copyright (c) .NET Core Community. All rights reserved. | |||||
// Licensed under the MIT License. See License.txt in the project root for license information. | |||||
using System; | |||||
using Microsoft.Extensions.Logging; | |||||
namespace DotNetCore.CAP.Internal | |||||
{ | |||||
internal class ConsumerInvokerFactory : ISubscribeInvokerFactory | |||||
{ | |||||
private readonly ILoggerFactory _loggerFactory; | |||||
private readonly IServiceProvider _serviceProvider; | |||||
public ConsumerInvokerFactory( | |||||
ILoggerFactory loggerFactory, | |||||
IServiceProvider serviceProvider) | |||||
{ | |||||
_loggerFactory = loggerFactory; | |||||
_serviceProvider = serviceProvider; | |||||
} | |||||
public ISubscribeInvoker CreateInvoker() | |||||
{ | |||||
return new SubscribeInvoker(_loggerFactory, _serviceProvider); | |||||
} | |||||
} | |||||
} |
@@ -38,7 +38,7 @@ namespace DotNetCore.CAP.Internal | |||||
_options = options.Value; | _options = options.Value; | ||||
_dataStorage = _provider.GetService<IDataStorage>(); | _dataStorage = _provider.GetService<IDataStorage>(); | ||||
Invoker = _provider.GetService<ISubscribeInvokerFactory>().CreateInvoker(); | |||||
Invoker = _provider.GetService<SubscribeInvoker>(); | |||||
} | } | ||||
private ISubscribeInvoker Invoker { get; } | private ISubscribeInvoker Invoker { get; } | ||||
@@ -1,10 +0,0 @@ | |||||
// Copyright (c) .NET Core Community. All rights reserved. | |||||
// Licensed under the MIT License. See License.txt in the project root for license information. | |||||
namespace DotNetCore.CAP.Internal | |||||
{ | |||||
internal interface ISubscribeInvokerFactory | |||||
{ | |||||
ISubscribeInvoker CreateInvoker(); | |||||
} | |||||
} |