private async Task PublishPendingIntegrationEvents(CancellationToken cancellationToken) { var pendingLogEvents = await _eventLogService .RetrieveScopedEventsPendingToPublishAsync(); foreach (var logEvt in pendingLogEvents) { try { await _eventLogService.MarkEventAsInProgressAsync(logEvt.EventId); _logger.LogInformation("----- Publishing integration event: {IntegrationEventId}", logEvt.EventId); await _eventsPublisher.Publish(logEvt.IntegrationEvent, cancellationToken); _logger.LogInformation("----- Published integration event: {IntegrationEventId}", logEvt.EventId); await _eventLogService.MarkEventAsPublishedAsync(logEvt.EventId); } catch (Exception ex) { _logger.LogError(ex, "ERROR publishing integration event: {IntegrationEventId}", logEvt.EventId); await _eventLogService.MarkEventAsFailedAsync(logEvt.EventId); } } }
public async Task <ActionResult> CheckIn(string roomId) { await _publisher.Publish(new RoomCheckedIn(new RoomId(roomId))); return(View()); }
public Task ReportDamage(IEventsPublisher publisher, string content) { return(publisher.Publish(new RoomDamageReported(_roomId, content))); }
public Task RequestClean(IEventsPublisher publisher) { return(publisher.Publish(new RoomCleaningRequested(_roomId))); }
public Task CheckingDone(IEventsPublisher publisher) { return(publisher.Publish(new RoomCheckedAsOk(_roomId))); }
public Task Checkout(IEventsPublisher publisher, RoomId roomId) { return(publisher.Publish(new GuestCheckedOut(roomId))); }