예제 #1
0
    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());
        }
예제 #3
0
 public Task ReportDamage(IEventsPublisher publisher, string content)
 {
     return(publisher.Publish(new RoomDamageReported(_roomId, content)));
 }
예제 #4
0
 public Task RequestClean(IEventsPublisher publisher)
 {
     return(publisher.Publish(new RoomCleaningRequested(_roomId)));
 }
예제 #5
0
 public Task CheckingDone(IEventsPublisher publisher)
 {
     return(publisher.Publish(new RoomCheckedAsOk(_roomId)));
 }
예제 #6
0
 public Task Checkout(IEventsPublisher publisher, RoomId roomId)
 {
     return(publisher.Publish(new GuestCheckedOut(roomId)));
 }