public bool Stop(HostControl hostControl) { CategoryCommanderActor.Tell(PoisonPill.Instance); CategoryQueryActor.Tell(PoisonPill.Instance); GlobalActorSystem.Terminate().Wait(5000); return(true); }
public bool Start(HostControl hostControl) { GlobalActorSystem = ActorSystem.Create("magazine-system"); CategoryCommanderActor = GlobalActorSystem.CategoryCommanderAggregate(Guid.NewGuid()); CategoryQueryActor = GlobalActorSystem.CategoryQueryAggregate(); return(true); }
public bool Stop(HostControl hostControl) { _logger.Information("Release the actor system, query, commander and process manager resources."); CategoryCommanderActor.Tell(PoisonPill.Instance); CategoryQueryActor.Tell(PoisonPill.Instance); GlobalActorSystem.Terminate(); return(true); }
public bool Start(HostControl hostControl) { _logger.Information("Create an actor system, query and commander."); GlobalActorSystem = ActorSystem.Create("magazine-system"); CategoryCommanderActor = GlobalActorSystem.CategoryCommanderAggregate(new Guid("8f88d4f42e3c4a868b4667dfe5f97bea")); CategoryQueryActor = GlobalActorSystem.CategoryQueryAggregate(); // config for mongo // TODO: need to scan all the events and map it to BsonClassMap BsonClassMap.RegisterClassMap <CategoryCreated>(); BsonClassMap.RegisterClassMap <CategoryStatusUpdated>(); return(true); }
public bool Start(HostControl hostControl) { GlobalActorSystem = ActorSystem.Create("magazine-system"); var categorySagaProps = new ConsistentHashingPool(2).Props( Props.Create(() => new CategoryStatusWorkflow( new Guid("8f88d4f42e3c4a868b4667dfe5f97bea")))); CategoryStatusSagaActor = GlobalActorSystem.ActorOf( categorySagaProps, "category-status-broadcaster"); if (!BsonClassMap.IsClassMapRegistered(typeof(PersistentFSMBase <, ,> .StateChangeEvent))) { BsonClassMap.RegisterClassMap <PersistentFSMBase <Status, List <CategoryData>, Event> .StateChangeEvent>(); } if (!BsonClassMap.IsClassMapRegistered(typeof(CategoryStatusUpdated))) { BsonClassMap.RegisterClassMap <CategoryStatusUpdated>(); } return(true); }
/// <summary> /// http://stackoverflow.com/questions/39656932/how-to-handle-async-start-errors-in-topshelf /// </summary> /// <returns></returns> private async Task StopAsync() { CategoryStatusSagaActor.Tell(PoisonPill.Instance); await GlobalActorSystem.Terminate(); }