Browse Source

Wrongly located Integration event is removed.

pull/2134/head
hsn 1 year ago
parent
commit
0cc909b660
3 changed files with 0 additions and 52 deletions
  1. +0
    -40
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderCompletedIntegrationEventHandler.cs
  2. +0
    -10
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderCompletedIntegrationEvent.cs
  3. +0
    -2
      src/Services/Ordering/Ordering.API/Program.cs

+ 0
- 40
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderCompletedIntegrationEventHandler.cs View File

@ -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);
}
}
}

+ 0
- 10
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/Events/OrderCompletedIntegrationEvent.cs View File

@ -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;
}

+ 0
- 2
src/Services/Ordering/Ordering.API/Program.cs View File

@ -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…
Cancel
Save