Skip to content

Commit 58b3b6f

Browse files
committed
Fix merge
1 parent c7e88d4 commit 58b3b6f

1 file changed

Lines changed: 9 additions & 28 deletions

File tree

src/Services/Ordering/Ordering.API/Startup.cs

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
using System;
3232
using System.Data.Common;
3333
using System.Reflection;
34-
using global::Ordering.API.Application.IntegrationEvents.EventHandling;
3534

3635
public class Startup
3736
{
@@ -125,13 +124,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
125124
return new DefaultRabbitMQPersistentConnection(factory, logger);
126125
});
127126

128-
RegisterServiceBus(services);
129-
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
130-
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
131-
services.AddTransient<UserCheckoutAcceptedIntegrationEventHandler>();
132-
services.AddTransient<IIntegrationEventHandler<ConfirmGracePeriodCommandMsg>, OrderProcessSaga>();
133-
services.AddTransient<OrderStockConfirmedIntegrationEventHandler>();
134-
services.AddTransient<OrderStockNotConfirmedIntegrationEventHandler>();
127+
RegisterServiceBus(services);
135128
services.AddOptions();
136129

137130
//configure autofac
@@ -176,36 +169,24 @@ private void RegisterServiceBus(IServiceCollection services)
176169
{
177170
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
178171
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
179-
180-
services.AddTransient<IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>>();
181172
services.AddTransient<IIntegrationEventHandler<ConfirmGracePeriodCommand>, OrderProcessSaga>();
182-
services.AddTransient<IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>,
183-
OrderStockConfirmedIntegrationEventHandler>();
184-
services.AddTransient<IIntegrationEventHandler<OrderStockNotConfirmedIntegrationEvent>,
185-
OrderStockNotConfirmedIntegrationEventHandler>();
186-
services.AddTransient<IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>,
187-
OrderPaymentFailedIntegrationEventHandler>();
188-
services.AddTransient<IIntegrationEventHandler<OrderPaymentSuccededIntegrationEvent>,
189-
OrderPaymentSuccededIntegrationEventHandler>();
173+
services.AddTransient<UserCheckoutAcceptedIntegrationEventHandler>();
174+
services.AddTransient<OrderStockConfirmedIntegrationEventHandler>();
175+
services.AddTransient<OrderStockNotConfirmedIntegrationEventHandler>();
176+
services.AddTransient<OrderPaymentFailedIntegrationEventHandler>();
177+
services.AddTransient<OrderPaymentSuccededIntegrationEventHandler>();
190178
}
191179

192180
private void ConfigureEventBus(IApplicationBuilder app)
193181
{
194182
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
195183

196-
eventBus.Subscribe<UserCheckoutAcceptedIntegrationEvent, IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>>();
197184
eventBus.Subscribe<ConfirmGracePeriodCommand, IIntegrationEventHandler<ConfirmGracePeriodCommand>>();
198-
eventBus.Subscribe<OrderStockConfirmedIntegrationEvent, IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>>();
199-
eventBus.Subscribe<OrderStockNotConfirmedIntegrationEvent, IIntegrationEventHandler<OrderStockNotConfirmedIntegrationEvent>>();
200-
eventBus.Subscribe<OrderPaymentFailedIntegrationEvent, IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>>();
201-
eventBus.Subscribe<OrderPaymentSuccededIntegrationEvent, IIntegrationEventHandler<OrderPaymentSuccededIntegrationEvent>>();
202-
eventBus.Subscribe<UserCheckoutAcceptedIntegrationEvent, UserCheckoutAcceptedIntegrationEventHandler>();
203-
204-
eventBus.Subscribe<ConfirmGracePeriodCommandMsg, IIntegrationEventHandler<ConfirmGracePeriodCommandMsg>>();
205-
185+
eventBus.Subscribe<UserCheckoutAcceptedIntegrationEvent, UserCheckoutAcceptedIntegrationEventHandler>();
206186
eventBus.Subscribe<OrderStockConfirmedIntegrationEvent, OrderStockConfirmedIntegrationEventHandler>();
207-
208187
eventBus.Subscribe<OrderStockNotConfirmedIntegrationEvent, OrderStockNotConfirmedIntegrationEventHandler>();
188+
eventBus.Subscribe<OrderPaymentFailedIntegrationEvent, OrderPaymentFailedIntegrationEventHandler>();
189+
eventBus.Subscribe<OrderPaymentSuccededIntegrationEvent, OrderPaymentSuccededIntegrationEventHandler>();
209190
}
210191

211192
protected virtual void ConfigureAuth(IApplicationBuilder app)

0 commit comments

Comments
 (0)