void ConfigureProjections() { _checkpointTracker.SetUp(_allProjections, 1); var lastCommit = GetLastCommitId(); foreach (var slot in _projectionsBySlot) { var maxCheckpointDispatchedInSlot = slot.Value .Select(projection => { var checkpoint = _checkpointTracker.GetCheckpoint(projection); var longCheckpoint = LongCheckpoint.Parse(checkpoint); return(longCheckpoint.LongValue); }) .Max(); foreach (var projection in slot.Value) { if (_checkpointTracker.NeedsRebuild(projection)) { //Check if this slot has ever dispatched at least one commit if (maxCheckpointDispatchedInSlot > 0) { _checkpointTracker.SetCheckpoint(projection.GetCommonName(), maxCheckpointDispatchedInSlot.ToString()); projection.Drop(); projection.StartRebuild(_rebuildContext); _checkpointTracker.RebuildStarted(projection, lastCommit); } else { //this is a new slot, all the projection should execute //as if they are not in rebuild, because they are new //so we need to immediately stop rebuilding. projection.StopRebuild(); } } projection.SetUp(); } } var errors = _checkpointTracker.GetCheckpointErrors(); if (errors.Any()) { StringBuilder fullError = new StringBuilder(); foreach (var error in errors) { Logger.ErrorFormat("CheckpointError: {0}", error); fullError.AppendLine(error); } throw new Exception(String.Format("Found {0} errors in checkpoint status: {1}", errors.Count, fullError.ToString())); } }