Wrongly located Integration event is removed.
This commit is contained in:
parent
bb04842fe1
commit
0cc909b660
@ -1,40 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.EventHandling;
|
|
||||||
|
|
||||||
public class OrderCompletedIntegrationEventHandler : IIntegrationEventHandler<OrderCompletedIntegrationEvent>
|
|
||||||
{
|
|
||||||
private readonly IMediator _mediator;
|
|
||||||
private readonly ILogger<OrderCompletedIntegrationEventHandler> _logger;
|
|
||||||
|
|
||||||
public OrderCompletedIntegrationEventHandler(
|
|
||||||
IMediator mediator,
|
|
||||||
ILogger<OrderCompletedIntegrationEventHandler> logger)
|
|
||||||
{
|
|
||||||
_mediator = mediator;
|
|
||||||
_logger = logger ?? throw new System.ArgumentNullException(nameof(logger));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event handler which confirms order is completed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="event">
|
|
||||||
/// </param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task Handle(OrderCompletedIntegrationEvent @event)
|
|
||||||
{
|
|
||||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
|
||||||
|
|
||||||
var command = new SetAwaitingValidationOrderStatusCommand(@event.OrderId);
|
|
||||||
|
|
||||||
_logger.LogInformation(
|
|
||||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
|
||||||
command.GetGenericTypeName(),
|
|
||||||
nameof(command.OrderNumber),
|
|
||||||
command.OrderNumber,
|
|
||||||
command);
|
|
||||||
|
|
||||||
await _mediator.Send(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.IntegrationEvents.Events;
|
|
||||||
|
|
||||||
public record OrderCompletedIntegrationEvent : IntegrationEvent
|
|
||||||
{
|
|
||||||
public int OrderId { get; }
|
|
||||||
|
|
||||||
public OrderCompletedIntegrationEvent(int orderId) =>
|
|
||||||
OrderId = orderId;
|
|
||||||
}
|
|
||||||
|
|
@ -35,7 +35,6 @@ services.AddScoped<IRequestManager, RequestManager>();
|
|||||||
|
|
||||||
// Add integration event handlers.
|
// Add integration event handlers.
|
||||||
services.AddTransient<IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>, GracePeriodConfirmedIntegrationEventHandler>();
|
services.AddTransient<IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>, GracePeriodConfirmedIntegrationEventHandler>();
|
||||||
services.AddTransient<IIntegrationEventHandler<OrderCompletedIntegrationEvent>, OrderCompletedIntegrationEventHandler>();
|
|
||||||
services.AddTransient<IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>, OrderPaymentFailedIntegrationEventHandler>();
|
services.AddTransient<IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>, OrderPaymentFailedIntegrationEventHandler>();
|
||||||
services.AddTransient<IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>, OrderPaymentSucceededIntegrationEventHandler>();
|
services.AddTransient<IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>, OrderPaymentSucceededIntegrationEventHandler>();
|
||||||
services.AddTransient<IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>, OrderStockConfirmedIntegrationEventHandler>();
|
services.AddTransient<IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>, OrderStockConfirmedIntegrationEventHandler>();
|
||||||
@ -53,7 +52,6 @@ var eventBus = app.Services.GetRequiredService<IEventBus>();
|
|||||||
|
|
||||||
eventBus.Subscribe<UserCheckoutAcceptedIntegrationEvent, IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>>();
|
eventBus.Subscribe<UserCheckoutAcceptedIntegrationEvent, IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>>();
|
||||||
eventBus.Subscribe<GracePeriodConfirmedIntegrationEvent, IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>>();
|
eventBus.Subscribe<GracePeriodConfirmedIntegrationEvent, IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>>();
|
||||||
eventBus.Subscribe<OrderCompletedIntegrationEvent, IIntegrationEventHandler<OrderCompletedIntegrationEvent>>();
|
|
||||||
eventBus.Subscribe<OrderStockConfirmedIntegrationEvent, IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>>();
|
eventBus.Subscribe<OrderStockConfirmedIntegrationEvent, IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>>();
|
||||||
eventBus.Subscribe<OrderStockRejectedIntegrationEvent, IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>>();
|
eventBus.Subscribe<OrderStockRejectedIntegrationEvent, IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>>();
|
||||||
eventBus.Subscribe<OrderPaymentFailedIntegrationEvent, IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>>();
|
eventBus.Subscribe<OrderPaymentFailedIntegrationEvent, IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user