コード例 #1
0
 void HandleRebuildResult(ReplayResult result, RebuildProjectionVersion @event)
 {
     if (result.IsSuccess)
     {
         var finalize = new FinalizeProjectionVersionRequest(@event.ProjectionVersionRequest.Id, @event.ProjectionVersionRequest.Version);
         commandPublisher.Publish(finalize);
     }
     else if (result.ShouldRetry)
     {
         RequestTimeout(new RebuildProjectionVersion(@event.ProjectionVersionRequest, DateTime.UtcNow.AddSeconds(30)));
     }
     else
     {
         log.Error(() => result.Error);
         if (result.IsTimeout)
         {
             var timedout = new TimeoutProjectionVersionRequest(@event.ProjectionVersionRequest.Id, @event.ProjectionVersionRequest.Version, @event.ProjectionVersionRequest.Timebox);
             commandPublisher.Publish(timedout);
         }
         else
         {
             var cancel = new CancelProjectionVersionRequest(@event.ProjectionVersionRequest.Id, @event.ProjectionVersionRequest.Version, result.Error);
             commandPublisher.Publish(cancel);
         }
     }
 }
コード例 #2
0
        public void Handle(RebuildProjectionVersion @event)
        {
            if (Player.RebuildIndex() == false)
            {
                RequestTimeout(new RebuildProjectionVersion(@event.ProjectionVersionRequest, DateTime.UtcNow.AddSeconds(30)));
                return;
            }
            var rebuildUntil = @event.ProjectionVersionRequest.Timebox.RebuildFinishUntil;

            if (rebuildUntil < DateTime.UtcNow)
            {
                return;
            }

            var theType           = @event.ProjectionVersionRequest.ProjectionVersion.ProjectionName.GetTypeByContract();
            var rebuildTimesOutAt = @event.ProjectionVersionRequest.Timebox.RebuildFinishUntil;

            if (Player.Rebuild(theType, @event.ProjectionVersionRequest.ProjectionVersion, rebuildTimesOutAt))
            {
                var command = new FinalizeProjectionVersionRequest(@event.ProjectionVersionRequest.Id, @event.ProjectionVersionRequest.ProjectionVersion);
                CommandPublisher.Publish(command);
            }
        }
コード例 #3
0
        public void Handle(RebuildProjectionVersion @event)
        {
            ReplayResult result = projectionPlayer.Rebuild(@event.ProjectionVersionRequest.Version, @event.ProjectionVersionRequest.Timebox.RebuildFinishUntil);

            HandleRebuildResult(result, @event);
        }