Ejemplo n.º 1
0
        public async Task PublishEvent(IntegrationEvent @event)
        {
            if (_integrationEventLogService.Find(@event.Id) == null)
            {
                throw new IntegrationEventWithIdDoesNotExistsException(@event.Id);
            }

            try
            {
                _eventBus.Publish(@event);
                await _integrationEventLogService.MarkEventAsPublishedAsync(@event);
            }
            catch (FailToSendEventToRabbitException)
            {
                await _integrationEventLogService.MarkEventAsFailToPublishAsync(@event);

                throw;
            }
        }