Remove Program from Catalog.API
This commit is contained in:
parent
7d28625959
commit
3f5f0b94ed
@ -17,7 +17,7 @@ public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandl
|
|||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}"))
|
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}"))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||||
|
|
||||||
var userIds = _repository.GetUsers();
|
var userIds = _repository.GetUsers();
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class BasketScenarioBase
|
|||||||
|
|
||||||
public TestServer CreateServer()
|
public TestServer CreateServer()
|
||||||
{
|
{
|
||||||
var factory = new BasketApplicaton();
|
var factory = new BasketApplication();
|
||||||
return factory.Server;
|
return factory.Server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class BasketScenarioBase
|
|||||||
public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
|
public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BasketApplicaton : WebApplicationFactory<Program>
|
private class BasketApplication : WebApplicationFactory<Program>
|
||||||
{
|
{
|
||||||
protected override IHost CreateHost(IHostBuilder builder)
|
protected override IHost CreateHost(IHostBuilder builder)
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,10 @@
|
|||||||
<None Remove="@(Protobuf)" />
|
<None Remove="@(Protobuf)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<InternalsVisibleTo Include="Catalog.FunctionalTests"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
|
||||||
<PackageReference Include="Azure.Identity" />
|
<PackageReference Include="Azure.Identity" />
|
||||||
|
@ -26,7 +26,7 @@ public class CatalogIntegrationEventService : ICatalogIntegrationEventService, I
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId_published} from {AppName} - ({@IntegrationEvent})", evt.Id, Program.AppName, evt);
|
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId_published} - ({@IntegrationEvent})", evt.Id, evt);
|
||||||
|
|
||||||
await _eventLogService.MarkEventAsInProgressAsync(evt.Id);
|
await _eventLogService.MarkEventAsInProgressAsync(evt.Id);
|
||||||
_eventBus.Publish(evt);
|
_eventBus.Publish(evt);
|
||||||
@ -34,7 +34,7 @@ public class CatalogIntegrationEventService : ICatalogIntegrationEventService, I
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", evt.Id, Program.AppName, evt);
|
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", evt.Id, evt);
|
||||||
await _eventLogService.MarkEventAsFailedAsync(evt.Id);
|
await _eventLogService.MarkEventAsFailedAsync(evt.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||||
|
|
||||||
var confirmedOrderStockItems = new List<ConfirmedOrderStockItem>();
|
var confirmedOrderStockItems = new List<ConfirmedOrderStockItem>();
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ public class OrderStatusChangedToPaidIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||||
|
|
||||||
//we're not blocking stock/inventory
|
//we're not blocking stock/inventory
|
||||||
foreach (var orderStockItem in @event.OrderStockItems)
|
foreach (var orderStockItem in @event.OrderStockItems)
|
||||||
|
@ -41,11 +41,8 @@ var eventBus = app.Services.GetRequiredService<IEventBus>();
|
|||||||
eventBus.Subscribe<OrderStatusChangedToAwaitingValidationIntegrationEvent, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
|
eventBus.Subscribe<OrderStatusChangedToAwaitingValidationIntegrationEvent, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
|
||||||
eventBus.Subscribe<OrderStatusChangedToPaidIntegrationEvent, OrderStatusChangedToPaidIntegrationEventHandler>();
|
eventBus.Subscribe<OrderStatusChangedToPaidIntegrationEvent, OrderStatusChangedToPaidIntegrationEventHandler>();
|
||||||
|
|
||||||
try
|
using (var scope = app.Services.CreateScope())
|
||||||
{
|
{
|
||||||
app.Logger.LogInformation("Configuring web host ({ApplicationContext})...", AppName);
|
|
||||||
|
|
||||||
using var scope = app.Services.CreateScope();
|
|
||||||
var context = scope.ServiceProvider.GetRequiredService<CatalogContext>();
|
var context = scope.ServiceProvider.GetRequiredService<CatalogContext>();
|
||||||
var settings = app.Services.GetService<IOptions<CatalogSettings>>();
|
var settings = app.Services.GetService<IOptions<CatalogSettings>>();
|
||||||
var logger = app.Services.GetService<ILogger<CatalogContextSeed>>();
|
var logger = app.Services.GetService<ILogger<CatalogContextSeed>>();
|
||||||
@ -54,19 +51,6 @@ try
|
|||||||
await new CatalogContextSeed().SeedAsync(context, app.Environment, settings, logger);
|
await new CatalogContextSeed().SeedAsync(context, app.Environment, settings, logger);
|
||||||
var integEventContext = scope.ServiceProvider.GetRequiredService<IntegrationEventLogContext>();
|
var integEventContext = scope.ServiceProvider.GetRequiredService<IntegrationEventLogContext>();
|
||||||
await integEventContext.Database.MigrateAsync();
|
await integEventContext.Database.MigrateAsync();
|
||||||
app.Logger.LogInformation("Starting web host ({ApplicationName})...", AppName);
|
|
||||||
await app.RunAsync();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
app.Logger.LogCritical(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Program
|
await app.RunAsync();
|
||||||
{
|
|
||||||
public static string Namespace = typeof(Program).Assembly.GetName().Name;
|
|
||||||
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
|
||||||
}
|
|
||||||
|
@ -2,8 +2,16 @@
|
|||||||
|
|
||||||
namespace Catalog.FunctionalTests;
|
namespace Catalog.FunctionalTests;
|
||||||
|
|
||||||
public class CatalogScenariosBase : WebApplicationFactory<Program>
|
public class CatalogScenariosBase
|
||||||
{
|
{
|
||||||
|
public TestServer CreateServer()
|
||||||
|
{
|
||||||
|
var factory = new CatalogApplication();
|
||||||
|
return factory.CreateServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CatalogApplication : WebApplicationFactory<Program>
|
||||||
|
{
|
||||||
public TestServer CreateServer()
|
public TestServer CreateServer()
|
||||||
{
|
{
|
||||||
Services
|
Services
|
||||||
@ -33,6 +41,7 @@ public class CatalogScenariosBase : WebApplicationFactory<Program>
|
|||||||
|
|
||||||
return base.CreateHost(builder);
|
return base.CreateHost(builder);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Get
|
public static class Get
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHand
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task Handle(GracePeriodConfirmedIntegrationEvent @event)
|
public async Task Handle(GracePeriodConfirmedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderPaymentFailedIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderPaymentFailedIntegrationEvent @event)
|
public async Task Handle(OrderPaymentFailedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderPaymentSucceededIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderPaymentSucceededIntegrationEvent @event)
|
public async Task Handle(OrderPaymentSucceededIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderStockConfirmedIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
|
public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandle
|
|||||||
|
|
||||||
public async Task Handle(OrderStockRejectedIntegrationEvent @event)
|
public async Task Handle(OrderStockRejectedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHand
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task Handle(UserCheckoutAcceptedIntegrationEvent @event)
|
public async Task Handle(UserCheckoutAcceptedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler : IIn
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderStatusChangedToCancelledIntegrationEventHandler : IIntegration
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToCancelledIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToCancelledIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderStatusChangedToPaidIntegrationEventHandler : IIntegrationEvent
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class OrderStatusChangedToShippedIntegrationEventHandler : IIntegrationEv
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToShippedIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToShippedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class OrderStatusChangedToSubmittedIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToSubmittedIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToSubmittedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
|||||||
|
|
||||||
public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
|
public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", @event.Id))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user