Ejemplo n.º 1
0
        public IAsyncBackgroundJob CreateRebuildJob(ReadModelRebuildScope scope)
        {
            string id;
            Func <IEnumerable <int> >            getIds = null;
            PendingReadModelUpdateSourceCategory updateSourceCategory;

            switch (scope)
            {
            case ReadModelRebuildScope.ItSystemUsage:
                id     = StandardJobIds.RebuildItSystemUsageReadModels;
                getIds = () => _systemUsageRepository.AsQueryable().Select(x => x.Id).AsEnumerable();
                updateSourceCategory = PendingReadModelUpdateSourceCategory.ItSystemUsage;
                break;

            case ReadModelRebuildScope.DataProcessingRegistration:
                id     = StandardJobIds.RebuildDataProcessingReadModels;
                getIds = () => _dprRepository.AsQueryable().Select(x => x.Id).AsEnumerable();
                updateSourceCategory = PendingReadModelUpdateSourceCategory.DataProcessingRegistration;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(scope), scope, null);
            }
            return(new RebuildReadModelsJob(id, getIds, updateSourceCategory, _pendingReadModelUpdateRepository));
        }
Ejemplo n.º 2
0
        public async Task LaunchFullReadModelRebuild(ReadModelRebuildScope scope, CancellationToken token)
        {
            var job = _rebuildReadModelsJobFactory.CreateRebuildJob(scope);

            await Launch(job, token);
        }