Remove autofac from the solution
This commit is contained in:
parent
3af7133157
commit
89c2291812
@ -6,6 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||||
|
{
|
||||||
|
public static class EventBusServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddEventHandlers(this IServiceCollection services, System.Reflection.Assembly assembly)
|
||||||
|
{
|
||||||
|
foreach (var typeInfo in assembly.GetTypes()
|
||||||
|
.Where(t => typeof(IIntegrationEventHandler).IsAssignableFrom(t)
|
||||||
|
&& t.IsClass
|
||||||
|
&& !t.IsAbstract
|
||||||
|
&& !t.ContainsGenericParameters
|
||||||
|
&& t.GetConstructors(BindingFlags.Public | BindingFlags.Instance)?.Length != 0))
|
||||||
|
{
|
||||||
|
services.AddScoped(typeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,26 +3,24 @@
|
|||||||
public class EventBusRabbitMQ : IEventBus, IDisposable
|
public class EventBusRabbitMQ : IEventBus, IDisposable
|
||||||
{
|
{
|
||||||
const string BROKER_NAME = "eshop_event_bus";
|
const string BROKER_NAME = "eshop_event_bus";
|
||||||
const string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
|
|
||||||
|
|
||||||
private readonly IRabbitMQPersistentConnection _persistentConnection;
|
private readonly IRabbitMQPersistentConnection _persistentConnection;
|
||||||
private readonly ILogger<EventBusRabbitMQ> _logger;
|
private readonly ILogger<EventBusRabbitMQ> _logger;
|
||||||
private readonly IEventBusSubscriptionsManager _subsManager;
|
private readonly IEventBusSubscriptionsManager _subsManager;
|
||||||
private readonly ILifetimeScope _autofac;
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
private readonly int _retryCount;
|
private readonly int _retryCount;
|
||||||
|
|
||||||
private IModel _consumerChannel;
|
private IModel _consumerChannel;
|
||||||
private string _queueName;
|
private string _queueName;
|
||||||
|
|
||||||
public EventBusRabbitMQ(IRabbitMQPersistentConnection persistentConnection, ILogger<EventBusRabbitMQ> logger,
|
public EventBusRabbitMQ(IRabbitMQPersistentConnection persistentConnection, ILogger<EventBusRabbitMQ> logger,
|
||||||
ILifetimeScope autofac, IEventBusSubscriptionsManager subsManager, string queueName = null, int retryCount = 5)
|
IServiceScopeFactory serviceScopeFactory, IEventBusSubscriptionsManager subsManager, string queueName = null, int retryCount = 5)
|
||||||
{
|
{
|
||||||
_persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
|
_persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
|
||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
||||||
_queueName = queueName;
|
_queueName = queueName;
|
||||||
_consumerChannel = CreateConsumerChannel();
|
_consumerChannel = CreateConsumerChannel();
|
||||||
_autofac = autofac;
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
_retryCount = retryCount;
|
_retryCount = retryCount;
|
||||||
_subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
|
_subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
|
||||||
}
|
}
|
||||||
@ -244,14 +242,14 @@ public class EventBusRabbitMQ : IEventBus, IDisposable
|
|||||||
|
|
||||||
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
||||||
{
|
{
|
||||||
using (var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME))
|
using (var scope = _serviceScopeFactory.CreateScope())
|
||||||
{
|
{
|
||||||
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
|
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
|
||||||
foreach (var subscription in subscriptions)
|
foreach (var subscription in subscriptions)
|
||||||
{
|
{
|
||||||
if (subscription.IsDynamic)
|
if (subscription.IsDynamic)
|
||||||
{
|
{
|
||||||
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
|
var handler = scope.ServiceProvider.GetService(subscription.HandlerType) as IDynamicIntegrationEventHandler;
|
||||||
if (handler == null) continue;
|
if (handler == null) continue;
|
||||||
using dynamic eventData = JsonDocument.Parse(message);
|
using dynamic eventData = JsonDocument.Parse(message);
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
@ -259,7 +257,7 @@ public class EventBusRabbitMQ : IEventBus, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var handler = scope.ResolveOptional(subscription.HandlerType);
|
var handler = scope.ServiceProvider.GetService(subscription.HandlerType);
|
||||||
if (handler == null) continue;
|
if (handler == null) continue;
|
||||||
var eventType = _subsManager.GetEventTypeByName(eventName);
|
var eventType = _subsManager.GetEventTypeByName(eventName);
|
||||||
var integrationEvent = JsonSerializer.Deserialize(message, eventType, new JsonSerializerOptions() { PropertyNameCaseInsensitive= true});
|
var integrationEvent = JsonSerializer.Deserialize(message, eventType, new JsonSerializerOptions() { PropertyNameCaseInsensitive= true});
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||||
<PackageReference Include="Polly" Version="7.2.1" />
|
<PackageReference Include="Polly" Version="7.2.1" />
|
||||||
|
@ -7,7 +7,7 @@ global using RabbitMQ.Client.Exceptions;
|
|||||||
global using System;
|
global using System;
|
||||||
global using System.IO;
|
global using System.IO;
|
||||||
global using System.Net.Sockets;
|
global using System.Net.Sockets;
|
||||||
global using Autofac;
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||||
|
@ -5,21 +5,20 @@ public class EventBusServiceBus : IEventBus, IDisposable
|
|||||||
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
|
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
|
||||||
private readonly ILogger<EventBusServiceBus> _logger;
|
private readonly ILogger<EventBusServiceBus> _logger;
|
||||||
private readonly IEventBusSubscriptionsManager _subsManager;
|
private readonly IEventBusSubscriptionsManager _subsManager;
|
||||||
private readonly ILifetimeScope _autofac;
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
private readonly string _topicName = "eshop_event_bus";
|
private readonly string _topicName = "eshop_event_bus";
|
||||||
private readonly string _subscriptionName;
|
private readonly string _subscriptionName;
|
||||||
private ServiceBusSender _sender;
|
private ServiceBusSender _sender;
|
||||||
private ServiceBusProcessor _processor;
|
private ServiceBusProcessor _processor;
|
||||||
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
|
|
||||||
private const string INTEGRATION_EVENT_SUFFIX = "IntegrationEvent";
|
private const string INTEGRATION_EVENT_SUFFIX = "IntegrationEvent";
|
||||||
|
|
||||||
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
|
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
|
||||||
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, ILifetimeScope autofac, string subscriptionClientName)
|
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, IServiceScopeFactory serviceScopeFactory, string subscriptionClientName)
|
||||||
{
|
{
|
||||||
_serviceBusPersisterConnection = serviceBusPersisterConnection;
|
_serviceBusPersisterConnection = serviceBusPersisterConnection;
|
||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
||||||
_autofac = autofac;
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
_subscriptionName = subscriptionClientName;
|
_subscriptionName = subscriptionClientName;
|
||||||
_sender = _serviceBusPersisterConnection.TopicClient.CreateSender(_topicName);
|
_sender = _serviceBusPersisterConnection.TopicClient.CreateSender(_topicName);
|
||||||
ServiceBusProcessorOptions options = new ServiceBusProcessorOptions { MaxConcurrentCalls = 10, AutoCompleteMessages = false };
|
ServiceBusProcessorOptions options = new ServiceBusProcessorOptions { MaxConcurrentCalls = 10, AutoCompleteMessages = false };
|
||||||
@ -155,14 +154,14 @@ public class EventBusServiceBus : IEventBus, IDisposable
|
|||||||
var processed = false;
|
var processed = false;
|
||||||
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
if (_subsManager.HasSubscriptionsForEvent(eventName))
|
||||||
{
|
{
|
||||||
using (var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME))
|
using (var scope = _serviceScopeFactory.CreateScope())
|
||||||
{
|
{
|
||||||
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
|
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
|
||||||
foreach (var subscription in subscriptions)
|
foreach (var subscription in subscriptions)
|
||||||
{
|
{
|
||||||
if (subscription.IsDynamic)
|
if (subscription.IsDynamic)
|
||||||
{
|
{
|
||||||
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
|
var handler = scope.ServiceProvider.GetService(subscription.HandlerType) as IDynamicIntegrationEventHandler;
|
||||||
if (handler == null) continue;
|
if (handler == null) continue;
|
||||||
|
|
||||||
using dynamic eventData = JsonDocument.Parse(message);
|
using dynamic eventData = JsonDocument.Parse(message);
|
||||||
@ -170,7 +169,7 @@ public class EventBusServiceBus : IEventBus, IDisposable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var handler = scope.ResolveOptional(subscription.HandlerType);
|
var handler = scope.ServiceProvider.GetService(subscription.HandlerType);
|
||||||
if (handler == null) continue;
|
if (handler == null) continue;
|
||||||
var eventType = _subsManager.GetEventTypeByName(eventName);
|
var eventType = _subsManager.GetEventTypeByName(eventName);
|
||||||
var integrationEvent = JsonSerializer.Deserialize(message, eventType);
|
var integrationEvent = JsonSerializer.Deserialize(message, eventType);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
|
||||||
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.2.1" />
|
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.2.1" />
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||||
|
@ -6,7 +6,7 @@ global using System.Linq;
|
|||||||
global using System.Text.Json.Serialization;
|
global using System.Text.Json.Serialization;
|
||||||
global using System.Threading.Tasks;
|
global using System.Threading.Tasks;
|
||||||
global using System;
|
global using System;
|
||||||
global using Autofac;
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
global using Microsoft.Extensions.Logging;
|
global using Microsoft.Extensions.Logging;
|
||||||
global using System.Text;
|
global using System.Text;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.2" />
|
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.2" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0-preview.1" />
|
|
||||||
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
|
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
|
||||||
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.15.0" />
|
<PackageReference Include="Google.Protobuf" Version="3.15.0" />
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
global using Autofac.Extensions.DependencyInjection;
|
|
||||||
global using Autofac;
|
|
||||||
global using Azure.Core;
|
global using Azure.Core;
|
||||||
global using Azure.Identity;
|
global using Azure.Identity;
|
||||||
global using Basket.API.Infrastructure.ActionResults;
|
global using Basket.API.Infrastructure.ActionResults;
|
||||||
|
@ -9,7 +9,7 @@ public class Startup
|
|||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
|
public virtual void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddGrpc(options =>
|
services.AddGrpc(options =>
|
||||||
{
|
{
|
||||||
@ -135,11 +135,6 @@ public class Startup
|
|||||||
services.AddTransient<IIdentityService, IdentityService>();
|
services.AddTransient<IIdentityService, IdentityService>();
|
||||||
|
|
||||||
services.AddOptions();
|
services.AddOptions();
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.Populate(services);
|
|
||||||
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
@ -240,13 +235,13 @@ public class Startup
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -255,7 +250,7 @@ public class Startup
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -265,7 +260,7 @@ public class Startup
|
|||||||
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ namespace Basket.FunctionalTests.Base
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IServiceProvider ConfigureServices(IServiceCollection services)
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// Added to avoid the Authorize data annotation in test environment.
|
// Added to avoid the Authorize data annotation in test environment.
|
||||||
// Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json
|
// Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json
|
||||||
services.Configure<RouteOptions>(Configuration);
|
services.Configure<RouteOptions>(Configuration);
|
||||||
return base.ConfigureServices(services);
|
base.ConfigureServices(services);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ConfigureAuth(IApplicationBuilder app)
|
protected override void ConfigureAuth(IApplicationBuilder app)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
global using Azure.Core;
|
global using Azure.Core;
|
||||||
global using Azure.Identity;
|
global using Azure.Identity;
|
||||||
global using Autofac.Extensions.DependencyInjection;
|
|
||||||
global using Autofac;
|
|
||||||
global using Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
|
global using Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
|
||||||
global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.ActionResults;
|
global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.ActionResults;
|
||||||
global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Exceptions;
|
global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Exceptions;
|
||||||
|
@ -9,7 +9,7 @@ public class Startup
|
|||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddAppInsight(Configuration)
|
services.AddAppInsight(Configuration)
|
||||||
.AddGrpc().Services
|
.AddGrpc().Services
|
||||||
@ -20,11 +20,6 @@ public class Startup
|
|||||||
.AddEventBus(Configuration)
|
.AddEventBus(Configuration)
|
||||||
.AddSwagger(Configuration)
|
.AddSwagger(Configuration)
|
||||||
.AddCustomHealthCheck(Configuration);
|
.AddCustomHealthCheck(Configuration);
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.Populate(services);
|
|
||||||
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
||||||
@ -294,13 +289,13 @@ public static class CustomExtensionMethods
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = configuration["SubscriptionClientName"];
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -310,7 +305,7 @@ public static class CustomExtensionMethods
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -320,7 +315,7 @@ public static class CustomExtensionMethods
|
|||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
global using Microsoft.eShopOnContainers.Services.Identity.API.Extensions;
|
global using Microsoft.eShopOnContainers.Services.Identity.API.Extensions;
|
||||||
global using System.IO.Compression;
|
global using System.IO.Compression;
|
||||||
global using Autofac.Extensions.DependencyInjection;
|
|
||||||
global using Autofac;
|
|
||||||
global using Azure.Core;
|
global using Azure.Core;
|
||||||
global using Azure.Identity;
|
global using Azure.Identity;
|
||||||
global using HealthChecks.UI.Client;
|
global using HealthChecks.UI.Client;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
|
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0-preview.1" />
|
|
||||||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.1.4" />
|
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.1.4" />
|
||||||
<PackageReference Include="IdentityServer4.EntityFramework.Storage" Version="3.1.4" />
|
<PackageReference Include="IdentityServer4.EntityFramework.Storage" Version="3.1.4" />
|
||||||
<PackageReference Include="IdentityServer4.EntityFramework" Version="3.1.4" />
|
<PackageReference Include="IdentityServer4.EntityFramework" Version="3.1.4" />
|
||||||
|
@ -12,7 +12,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
RegisterAppInsights(services);
|
RegisterAppInsights(services);
|
||||||
|
|
||||||
@ -88,11 +88,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
services.AddControllersWithViews();
|
services.AddControllersWithViews();
|
||||||
services.AddRazorPages();
|
services.AddRazorPages();
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.Populate(services);
|
|
||||||
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
global using ApiModels = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
global using ApiModels = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
||||||
global using AppCommand = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
global using AppCommand = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
|
||||||
global using Autofac.Extensions.DependencyInjection;
|
|
||||||
global using Autofac;
|
|
||||||
global using Azure.Core;
|
global using Azure.Core;
|
||||||
global using Azure.Identity;
|
global using Azure.Identity;
|
||||||
global using Dapper;
|
global using Dapper;
|
||||||
@ -36,7 +34,6 @@ global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Comma
|
|||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStockConfirmed;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.DomainEventHandlers.OrderStockConfirmed;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
|
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
global using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
|
|
||||||
|
|
||||||
public class ApplicationModule
|
|
||||||
: Autofac.Module
|
|
||||||
{
|
|
||||||
|
|
||||||
public string QueriesConnectionString { get; }
|
|
||||||
|
|
||||||
public ApplicationModule(string qconstr)
|
|
||||||
{
|
|
||||||
QueriesConnectionString = qconstr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
|
|
||||||
builder.Register(c => new OrderQueries(QueriesConnectionString))
|
|
||||||
.As<IOrderQueries>()
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
builder.RegisterType<BuyerRepository>()
|
|
||||||
.As<IBuyerRepository>()
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
builder.RegisterType<OrderRepository>()
|
|
||||||
.As<IOrderRepository>()
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
builder.RegisterType<RequestManager>()
|
|
||||||
.As<IRequestManager>()
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
builder.RegisterAssemblyTypes(typeof(CreateOrderCommandHandler).GetTypeInfo().Assembly)
|
|
||||||
.AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
|
|
||||||
|
|
||||||
public class MediatorModule : Autofac.Module
|
|
||||||
{
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
builder.RegisterAssemblyTypes(typeof(IMediator).GetTypeInfo().Assembly)
|
|
||||||
.AsImplementedInterfaces();
|
|
||||||
|
|
||||||
// Register all the Command classes (they implement IRequestHandler) in assembly holding the Commands
|
|
||||||
builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly)
|
|
||||||
.AsClosedTypesOf(typeof(IRequestHandler<,>));
|
|
||||||
|
|
||||||
// Register the DomainEventHandler classes (they implement INotificationHandler<>) in assembly holding the Domain Events
|
|
||||||
builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly)
|
|
||||||
.AsClosedTypesOf(typeof(INotificationHandler<>));
|
|
||||||
|
|
||||||
// Register the Command's Validators (Validators based on FluentValidation library)
|
|
||||||
builder
|
|
||||||
.RegisterAssemblyTypes(typeof(CreateOrderCommandValidator).GetTypeInfo().Assembly)
|
|
||||||
.Where(t => t.IsClosedTypeOf(typeof(IValidator<>)))
|
|
||||||
.AsImplementedInterfaces();
|
|
||||||
|
|
||||||
|
|
||||||
builder.Register<ServiceFactory>(context =>
|
|
||||||
{
|
|
||||||
var componentContext = context.Resolve<IComponentContext>();
|
|
||||||
return t => { object o; return componentContext.TryResolve(t, out o) ? o : null; };
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.RegisterGeneric(typeof(LoggingBehavior<,>)).As(typeof(IPipelineBehavior<,>));
|
|
||||||
builder.RegisterGeneric(typeof(ValidatorBehavior<,>)).As(typeof(IPipelineBehavior<,>));
|
|
||||||
builder.RegisterGeneric(typeof(TransactionBehaviour<,>)).As(typeof(IPipelineBehavior<,>));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -40,7 +40,6 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
|
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.3" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
|
||||||
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
|
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
|
||||||
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
||||||
<PackageReference Include="Dapper" Version="2.0.78" />
|
<PackageReference Include="Dapper" Version="2.0.78" />
|
||||||
|
@ -9,7 +9,7 @@ public class Startup
|
|||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
|
public virtual void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services
|
services
|
||||||
.AddGrpc(options =>
|
.AddGrpc(options =>
|
||||||
@ -25,16 +25,13 @@ public class Startup
|
|||||||
.AddCustomIntegrations(Configuration)
|
.AddCustomIntegrations(Configuration)
|
||||||
.AddCustomConfiguration(Configuration)
|
.AddCustomConfiguration(Configuration)
|
||||||
.AddEventBus(Configuration)
|
.AddEventBus(Configuration)
|
||||||
.AddCustomAuthentication(Configuration);
|
.AddCustomAuthentication(Configuration)
|
||||||
//configure autofac
|
.AddScoped<IOrderQueries>(sp => new OrderQueries(Configuration["ConnectionString"]))
|
||||||
|
.AddScoped<IBuyerRepository, BuyerRepository>()
|
||||||
var container = new ContainerBuilder();
|
.AddScoped<IOrderRepository, OrderRepository>()
|
||||||
container.Populate(services);
|
.AddScoped<IRequestManager, RequestManager>()
|
||||||
|
.AddEventHandlers(typeof(CreateOrderCommandHandler).GetTypeInfo().Assembly)
|
||||||
container.RegisterModule(new MediatorModule());
|
.AddMediatR(Assembly.GetExecutingAssembly());
|
||||||
container.RegisterModule(new ApplicationModule(Configuration["ConnectionString"]));
|
|
||||||
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -332,13 +329,13 @@ static class CustomExtensionsMethods
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = configuration["SubscriptionClientName"];
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -347,7 +344,7 @@ static class CustomExtensionsMethods
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -357,7 +354,7 @@ static class CustomExtensionsMethods
|
|||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using Autofac;
|
using Azure.Messaging.ServiceBus;
|
||||||
using Azure.Messaging.ServiceBus;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||||
@ -61,12 +60,12 @@ namespace Ordering.BackgroundTasks.Extensions
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = configuration["SubscriptionClientName"];
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -104,7 +103,7 @@ namespace Ordering.BackgroundTasks.Extensions
|
|||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
|
||||||
{
|
{
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -115,7 +114,7 @@ namespace Ordering.BackgroundTasks.Extensions
|
|||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
|
||||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
|
||||||
<PackageReference Include="Dapper" Version="2.0.78" />
|
<PackageReference Include="Dapper" Version="2.0.78" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using Autofac.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -19,7 +18,6 @@ namespace Ordering.BackgroundTasks
|
|||||||
|
|
||||||
public static IHost CreateHostBuilder(string[] args) =>
|
public static IHost CreateHostBuilder(string[] args) =>
|
||||||
Host.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
|
||||||
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>())
|
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>())
|
||||||
.ConfigureAppConfiguration((host, builder) =>
|
.ConfigureAppConfiguration((host, builder) =>
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,12 @@ public class OrderingTestsStartup : Startup
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IServiceProvider ConfigureServices(IServiceCollection services)
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// Added to avoid the Authorize data annotation in test environment.
|
// Added to avoid the Authorize data annotation in test environment.
|
||||||
// Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json
|
// Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json
|
||||||
services.Configure<RouteOptions>(Configuration);
|
services.Configure<RouteOptions>(Configuration);
|
||||||
return base.ConfigureServices(services);
|
base.ConfigureServices(services);
|
||||||
}
|
}
|
||||||
protected override void ConfigureAuth(IApplicationBuilder app)
|
protected override void ConfigureAuth(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.AutofacModules;
|
|
||||||
|
|
||||||
public class ApplicationModule
|
|
||||||
: Autofac.Module
|
|
||||||
{
|
|
||||||
|
|
||||||
public string QueriesConnectionString { get; }
|
|
||||||
|
|
||||||
public ApplicationModule()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
|
|
||||||
builder.RegisterAssemblyTypes(typeof(OrderStatusChangedToAwaitingValidationIntegrationEvent).GetTypeInfo().Assembly)
|
|
||||||
.AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,4 @@
|
|||||||
global using Autofac.Extensions.DependencyInjection;
|
global using HealthChecks.UI.Client;
|
||||||
global using Autofac;
|
|
||||||
global using HealthChecks.UI.Client;
|
|
||||||
global using Microsoft.AspNetCore.Authentication.JwtBearer;
|
global using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
global using Microsoft.AspNetCore.Authorization;
|
global using Microsoft.AspNetCore.Authorization;
|
||||||
global using Microsoft.AspNetCore.Builder;
|
global using Microsoft.AspNetCore.Builder;
|
||||||
@ -20,7 +18,6 @@ global using Microsoft.Extensions.Configuration;
|
|||||||
global using Microsoft.Extensions.DependencyInjection;
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
global using Microsoft.Extensions.Diagnostics.HealthChecks;
|
global using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
global using Microsoft.Extensions.Logging;
|
global using Microsoft.Extensions.Logging;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.AutofacModules;
|
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
|
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
|
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
|
||||||
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents;
|
global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="5.1.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="5.1.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0-preview.1" />
|
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.18.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.18.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.18.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.18.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="2.0.2-beta2" />
|
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="2.0.2-beta2" />
|
||||||
|
@ -11,7 +11,7 @@ public class Startup
|
|||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services
|
services
|
||||||
.AddCustomHealthCheck(Configuration)
|
.AddCustomHealthCheck(Configuration)
|
||||||
@ -86,12 +86,7 @@ public class Startup
|
|||||||
|
|
||||||
services.AddOptions();
|
services.AddOptions();
|
||||||
|
|
||||||
//configure autofac
|
services.AddEventHandlers(typeof(OrderStatusChangedToAwaitingValidationIntegrationEvent).GetTypeInfo().Assembly);
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.RegisterModule(new ApplicationModule());
|
|
||||||
container.Populate(services);
|
|
||||||
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
@ -185,13 +180,13 @@ public class Startup
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -200,7 +195,7 @@ public class Startup
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -210,7 +205,7 @@ public class Startup
|
|||||||
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
global using Autofac.Extensions.DependencyInjection;
|
global using Azure.Core;
|
||||||
global using Autofac;
|
|
||||||
global using Azure.Core;
|
|
||||||
global using Azure.Identity;
|
global using Azure.Identity;
|
||||||
global using HealthChecks.UI.Client;
|
global using HealthChecks.UI.Client;
|
||||||
global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
|
||||||
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
|
|
||||||
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
<PackageReference Include="Azure.Identity" Version="1.4.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
||||||
|
@ -10,7 +10,7 @@ public class Startup
|
|||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddCustomHealthCheck(Configuration);
|
services.AddCustomHealthCheck(Configuration);
|
||||||
services.Configure<PaymentSettings>(Configuration);
|
services.Configure<PaymentSettings>(Configuration);
|
||||||
@ -59,10 +59,6 @@ public class Startup
|
|||||||
}
|
}
|
||||||
|
|
||||||
RegisterEventBus(services);
|
RegisterEventBus(services);
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.Populate(services);
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
@ -107,13 +103,13 @@ public class Startup
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -122,7 +118,7 @@ public class Startup
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -132,7 +128,7 @@ public class Startup
|
|||||||
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
global using Autofac.Extensions.DependencyInjection;
|
global using Devspaces.Support;
|
||||||
global using Autofac;
|
|
||||||
global using Devspaces.Support;
|
|
||||||
global using HealthChecks.UI.Client;
|
global using HealthChecks.UI.Client;
|
||||||
global using Microsoft.AspNetCore.Authentication.JwtBearer;
|
global using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
global using Microsoft.AspNetCore.Authorization;
|
global using Microsoft.AspNetCore.Authorization;
|
||||||
|
@ -9,7 +9,7 @@ public class Startup
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services
|
services
|
||||||
.AddAppInsight(Configuration)
|
.AddAppInsight(Configuration)
|
||||||
@ -27,10 +27,6 @@ public class Startup
|
|||||||
.AddTransient<IGrantUrlTesterService, GrantUrlTesterService>()
|
.AddTransient<IGrantUrlTesterService, GrantUrlTesterService>()
|
||||||
.AddTransient<IWebhooksRetriever, WebhooksRetriever>()
|
.AddTransient<IWebhooksRetriever, WebhooksRetriever>()
|
||||||
.AddTransient<IWebhooksSender, WebhooksSender>();
|
.AddTransient<IWebhooksSender, WebhooksSender>();
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
|
||||||
container.Populate(services);
|
|
||||||
return new AutofacServiceProvider(container.Build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
||||||
@ -175,13 +171,13 @@ static class CustomExtensionMethods
|
|||||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
{
|
{
|
||||||
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
string subscriptionName = configuration["SubscriptionClientName"];
|
string subscriptionName = configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
eventBusSubcriptionsManager, serviceScopeFactory, subscriptionName);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -191,7 +187,7 @@ static class CustomExtensionMethods
|
|||||||
{
|
{
|
||||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||||
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
|
||||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
var serviceScopeFactory = sp.GetRequiredService<IServiceScopeFactory>();
|
||||||
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
|
||||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
|
||||||
@ -201,7 +197,7 @@ static class CustomExtensionMethods
|
|||||||
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
retryCount = int.Parse(configuration["EventBusRetryCount"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, serviceScopeFactory, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
|
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
|
||||||
|
@ -20,7 +20,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5433:1433"
|
- "5433:1433"
|
||||||
volumes:
|
volumes:
|
||||||
- eshop-sqldata:/var/opt/mssql
|
- eshop-sqldata:/var/opt/mssql/data
|
||||||
|
|
||||||
nosqldata:
|
nosqldata:
|
||||||
ports:
|
ports:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user