Remove old integration event call from OrderStockConfirmedIntegrationEventHandler
This commit is contained in:
parent
7dd91bc244
commit
b88c15abe3
@ -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)
|
||||
|
@ -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…
x
Reference in New Issue
Block a user