public RebuildProjectionEngine(
            EventUnwinder eventUnwinder,
            IConcurrentCheckpointTracker checkpointTracker,
            IProjection[] projections,
            IRebuildContext rebuildContext,
            ProjectionEngineConfig config,
            ProjectionEventInspector projectionInspector,
            ILoggerThreadContextManager loggerThreadContextManager)
        {
            _eventUnwinder       = eventUnwinder;
            _checkpointTracker   = checkpointTracker;
            _rebuildContext      = rebuildContext;
            _config              = config;
            _projectionInspector = projectionInspector;

            if (_config.Slots[0] != "*")
            {
                projections = projections
                              .Where(x => _config.Slots.Any(y => y == x.Info.SlotName))
                              .ToArray();
            }

            _allProjections    = projections;
            _projectionsBySlot = projections
                                 .GroupBy(x => x.Info.SlotName)
                                 .ToDictionary(x => x.Key, x => x.OrderByDescending(p => p.Priority).ToArray());

            _metrics = new ProjectionMetrics(_allProjections);
            _loggerThreadContextManager = loggerThreadContextManager;

            HealthChecks.RegisterHealthCheck("RebuildProjectionEngine", (Func <HealthCheckResult>)HealthCheck);
        }
Exemple #2
0
        public RebuildProjectionEngine(
            EventUnwinder eventUnwinder,
            IConcurrentCheckpointTracker checkpointTracker,
            IProjection[] projections,
            IRebuildContext rebuildContext,
            ProjectionEngineConfig config,
            ProjectionEventInspector projectionInspector)
        {
            _eventUnwinder       = eventUnwinder;
            _checkpointTracker   = checkpointTracker;
            _rebuildContext      = rebuildContext;
            _config              = config;
            _projectionInspector = projectionInspector;

            if (_config.Slots[0] != "*")
            {
                projections = projections
                              .Where(x => _config.Slots.Any(y => y == x.GetSlotName()))
                              .ToArray();
            }

            _allProjections    = projections;
            _projectionsBySlot = projections
                                 .GroupBy(x => x.GetSlotName())
                                 .ToDictionary(x => x.Key, x => x.OrderByDescending(p => p.Priority).ToArray());

            _metrics = new ProjectionMetrics(_allProjections);
        }
Exemple #3
0
        public ConcurrentProjectionsEngine(
            IConcurrentCheckpointTracker checkpointTracker,
            IProjection[] projections,
            IPollingClient client,
            IHousekeeper housekeeper,
            IRebuildContext rebuildContext,
            INotifyCommitHandled notifyCommitHandled,
            ProjectionEngineConfig config)
        {
            _checkpointTracker   = checkpointTracker;
            _client              = client;
            _housekeeper         = housekeeper;
            _rebuildContext      = rebuildContext;
            _notifyCommitHandled = notifyCommitHandled;
            _config              = config;

            if (_config.Slots[0] != "*")
            {
                projections = projections
                              .Where(x => _config.Slots.Any(y => y == x.GetSlotName()))
                              .ToArray();
            }

            _allProjections    = projections;
            _projectionsBySlot = projections
                                 .GroupBy(x => x.GetSlotName())
                                 .ToDictionary(x => x.Key, x => x.OrderByDescending(p => p.Priority).ToArray());

            _metrics = new ProjectionMetrics(_allProjections);
        }
        public ProjectionEngine(
            Func <IPersistStreams, CommitPollingClient> pollingClientFactory,
            IConcurrentCheckpointTracker checkpointTracker,
            IProjection[] projections,
            IHousekeeper housekeeper,
            IRebuildContext rebuildContext,
            INotifyCommitHandled notifyCommitHandled,
            ProjectionEngineConfig config)
        {
            _pollingClientFactory = pollingClientFactory;
            _checkpointTracker    = checkpointTracker;
            _housekeeper          = housekeeper;
            _rebuildContext       = rebuildContext;
            _notifyCommitHandled  = notifyCommitHandled;
            _config = config;

            if (_config.Slots[0] != "*")
            {
                projections = projections
                              .Where(x => _config.Slots.Any(y => y == x.GetSlotName()))
                              .ToArray();
            }

            _allProjections    = projections;
            _projectionsBySlot = projections
                                 .GroupBy(x => x.GetSlotName())
                                 .ToDictionary(x => x.Key, x => x.OrderByDescending(p => p.Priority).ToArray());

            _metrics        = new ProjectionMetrics(_allProjections);
            _clients        = new List <CommitPollingClient>();
            _bucketToClient = new Dictionary <BucketInfo, CommitPollingClient>();
        }
Exemple #5
0
 public virtual async Task StopRebuildAsync()
 {
     foreach (var observer in _observers)
     {
         await observer.RebuildEndedAsync().ConfigureAwait(false);
     }
     this.RebuildContext = null;
 }
Exemple #6
0
 public virtual async Task StartRebuildAsync(IRebuildContext context)
 {
     this.RebuildContext = context;
     foreach (var observer in _observers)
     {
         await observer.RebuildStartedAsync().ConfigureAwait(false);
     }
 }
 public virtual void StopRebuild()
 {
     foreach (var observer in _observers)
     {
         observer.RebuildEnded();
     }
     this.RebuildContext = null;
 }
 public virtual void StartRebuild(IRebuildContext context)
 {
     this.RebuildContext = context;
     foreach (var observer in _observers)
     {
         observer.RebuildStarted();
     }
 }
Exemple #9
0
        public ProjectionEngine(
            ICommitPollingClientFactory pollingClientFactory,
            IConcurrentCheckpointTracker checkpointTracker,
            IProjection[] projections,
            IHousekeeper housekeeper,
            IRebuildContext rebuildContext,
            INotifyCommitHandled notifyCommitHandled,
            ProjectionEngineConfig config)
        {
            Logger             = NullLogger.Instance;
            _engineFatalErrors = new ConcurrentBag <string>();

            _pollingClientFactory = pollingClientFactory;
            _checkpointTracker    = checkpointTracker;
            _housekeeper          = housekeeper;
            _rebuildContext       = rebuildContext;
            _notifyCommitHandled  = notifyCommitHandled;
            _config = config;

            if (_config.Slots[0] != "*")
            {
                projections = projections
                              .Where(x => _config.Slots.Any(y => y == x.GetSlotName()))
                              .ToArray();
            }

            _allProjections    = projections;
            _projectionsBySlot = projections
                                 .GroupBy(x => x.GetSlotName())
                                 .ToDictionary(x => x.Key, x => x.OrderByDescending(p => p.Priority).ToArray());

            _metrics        = new ProjectionMetrics(_allProjections);
            _bucketToClient = new Dictionary <BucketInfo, ICommitPollingClient>();

            RegisterHealthCheck();
        }
 public MongoStorageFactory(IMongoDatabase db, IRebuildContext rebuildContext)
 {
     _db             = db;
     _rebuildContext = rebuildContext;
 }