Example #1
0
        public async Task PublishThroughEventBusAsync(IntegrationEvent @event)
        {
            _logger.LogInformation("Publishing integration event: {integrationEventId} from {appName} - ({@IntegrationEvent})", @event.Id, _appName, @event);

            try
            {
                await _integrationEventLogRepository.MarkEventAsInProgressAsync(@event.Id);

                await _bus.PublishAsync(@event);

                await _integrationEventLogRepository.MarkEventAsPublishedAsync(@event.Id);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId} from {appName} - ({@IntegrationEvent})", @event.Id, _appName, @event);
                await _integrationEventLogRepository.MarkEventAsFailedAsync(@event.Id);
            }
        }