Browse Source

Remove old integration event call from OrderStockConfirmedIntegrationEventHandler

pull/223/head
Christian Arenas 7 years ago
parent
commit
b88c15abe3
2 changed files with 0 additions and 14 deletions
  1. +0
    -10
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs
  2. +0
    -4
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockNotConfirmedIntegrationEventHandler.cs

+ 0
- 10
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs View File

@ -22,20 +22,10 @@
public async Task Handle(OrderStockConfirmedIntegrationEvent @event)
{
//TODO: 1) Updates the state to "StockValidated" and any meaningful OrderContextDescription message saying that all the items were confirmed with available stock, etc
var order = await _orderRepository.GetAsync(@event.OrderId);
CheckValidSagaId(order);
order.SetOrderStockConfirmed();
//Create Integration Event to be published through the Event Bus
var payOrderCommandMsg = new PayOrderCommandMsg(order.Id);
// Achieving atomicity between original Catalog database operation and the IntegrationEventLog thanks to a local transaction
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(payOrderCommandMsg);
// Publish through the Event Bus and mark the saved event as published
await _orderingIntegrationEventService.PublishThroughEventBusAsync(payOrderCommandMsg);
}
private void CheckValidSagaId(Order orderSaga)


+ 0
- 4
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockNotConfirmedIntegrationEventHandler.cs View File

@ -34,10 +34,6 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
.Select(c => c.ProductId);
orderToUpdate.SetOrderStockConfirmed(orderStockNotConfirmedItems);
var payOrderCommandMsg = new PayOrderCommandMsg(orderToUpdate.Id);
await _orderingIntegrationEventService.SaveEventAndOrderingContextChangesAsync(payOrderCommandMsg);
await _orderingIntegrationEventService.PublishThroughEventBusAsync(payOrderCommandMsg);
}
private void CheckValidSagaId(Order orderSaga)


Loading…
Cancel
Save