예제 #1
0
 internal void FinalizeEventProcessing(
     List <EmittedEvent[]> scheduledWrites, CheckpointTag eventCheckpointTag, float progress)
 {
     if (_state != State.Faulted && _state != State.FaultedStopping)
     {
         EnsureState(State.Running);
         //TODO: move to separate projection method and cache result in work item
         var checkpointTag = eventCheckpointTag;
         _checkpointManager.EventProcessed(
             GetProjectionState().Data, scheduledWrites, checkpointTag, progress);
     }
 }
예제 #2
0
        public void ProcessEvent()
        {
            if (!_subscribed)
            {
                throw new InvalidOperationException();
            }
            if (_projectionState != PhaseState.Running)
            {
                return;
            }

            var phaseCheckpointTag = CheckpointTag.FromPhase(_phase, completed: true);
            var writeResults       = WriteResults(phaseCheckpointTag);

            var writeEofResults = WriteEofEvent(phaseCheckpointTag);

            _emittedEventWriter.EventsEmitted(writeResults.Concat(writeEofResults).ToArray(), Guid.Empty, null);

            _checkpointManager.EventProcessed(phaseCheckpointTag, 100.0f);
            _coreProjection.CompletePhase();
        }
예제 #3
0
 public void FinalizeEventProcessing(
     EventProcessedResult result, CheckpointTag eventCheckpointTag, float progress)
 {
     if (_state == PhaseState.Running)
     {
         //TODO: move to separate projection method and cache result in work item
         if (result != null)
         {
             _resultWriter.AccountPartition(result);
             if (_projectionConfig.EmitEventEnabled && result.EmittedEvents != null)
             {
                 _resultWriter.EventsEmitted(result.EmittedEvents, result.CausedBy, result.CorrelationId);
             }
             if (result.NewState != null)
             {
                 _resultWriter.WriteRunningResult(result);
                 _checkpointManager.StateUpdated(result.Partition, result.OldState, result.NewState);
             }
         }
         _checkpointManager.EventProcessed(eventCheckpointTag, progress);
     }
 }