298
CHAPTER 7 | Implement resilient applications
// Achieving atomicity between original Catalog database operation and the
// IntegrationEventLog thanks to a local transaction
await _catalogIntegrationEventService.
SaveEventAndCatalogContextChangesAsync
(
priceChangedEvent);
// Publish through the Event Bus and mark the saved event as published
await _catalogIntegrationEventService.
PublishThroughEventBusAsync
(
priceChangedEvent);
}
// Just save the updated product because the Product's Price hasn't changed.
else
{
await _catalogContext.
SaveChangesAsync
();
}
Dostları ilə paylaş: