/// <summary> /// Starts the pipeline /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation("EventSaucing ProjectorPipeline starting"); // Ensure the Projector Status is initialised. ProjectorHelper.InitialiseProjectorStatusStore(_dbService); //create the commit serialiser actor and set its path var commitSerialisor = _actorSystem.ActorOf(_actorSystem.DI().Props <CommitSerialiserActor>(), nameof(CommitSerialiserActor)); _actorPaths.LocalCommitSerialisor = commitSerialisor.Path; _logger.LogInformation("EventSaucing ProjectorPipeline started"); return(Task.CompletedTask); }
private void InitialiseProjectors() { //Reflect on assembly to identify projectors and have DI create them var projectorTypes = ProjectorHelper.FindAllProjectorsInProject(); var projectorsMetaData = (from type in projectorTypes select new { Type = type, ActorRef = Context.ActorOf(Context.DI().Props(type), type.FullName), ProjectorId = type.GetProjectorId() } ).ToList(); //put the projectors in a broadcast router _projectorsBroadCastRouter = Context.ActorOf(Props.Empty.WithRouter(new BroadcastGroup(projectorsMetaData.Map(_ => _.ActorRef.Path.ToString()))), "ProjectionBroadcastRouter").Path; //tell them to catchup, else they will sit and wait for the first user activity (from the first commit) Context.ActorSelection(_projectorsBroadCastRouter).Tell(new CatchUpMessage()); }