|
|
@ -14,13 +14,14 @@ using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace Catalog.API.IntegrationEvents |
|
|
|
{ |
|
|
|
public class CatalogIntegrationEventService : ICatalogIntegrationEventService |
|
|
|
public class CatalogIntegrationEventService : ICatalogIntegrationEventService,IDisposable |
|
|
|
{ |
|
|
|
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory; |
|
|
|
private readonly IEventBus _eventBus; |
|
|
|
private readonly CatalogContext _catalogContext; |
|
|
|
private readonly IIntegrationEventLogService _eventLogService; |
|
|
|
private readonly ILogger<CatalogIntegrationEventService> _logger; |
|
|
|
private volatile bool disposedValue; |
|
|
|
|
|
|
|
public CatalogIntegrationEventService( |
|
|
|
ILogger<CatalogIntegrationEventService> logger, |
|
|
@ -65,5 +66,24 @@ namespace Catalog.API.IntegrationEvents |
|
|
|
await _eventLogService.SaveEventAsync(evt, _catalogContext.Database.CurrentTransaction); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposing) |
|
|
|
{ |
|
|
|
if (!disposedValue) |
|
|
|
{ |
|
|
|
if (disposing) |
|
|
|
{ |
|
|
|
(_eventLogService as IDisposable)?.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
disposedValue = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
Dispose(disposing: true); |
|
|
|
GC.SuppressFinalize(this); |
|
|
|
} |
|
|
|
} |
|
|
|
} |