コード例 #1
0
        public static ActorSystemEventRepository New(IActorSystemFactory factory, EventsAdaptersCatalog eventsAdaptersCatalog)
        {
            var actorSystem = factory.Create();

            actorSystem.InitDomainEventsSerialization(eventsAdaptersCatalog);
            return(new ActorSystemEventRepository(actorSystem));
        }
コード例 #2
0
        public async Task Start()
        {
            Log.Information("Starting GridDomain node {Id}", Id);

            _stopping             = false;
            EventsAdaptersCatalog = new EventsAdaptersCatalog();
            _containerBuilder     = new ContainerBuilder();

            System = _actorSystemFactory.Create();
            System.RegisterOnTermination(OnSystemTermination);

            System.InitLocalTransportExtension();
            Transport = System.GetTransport();

            _containerBuilder.Register(new GridNodeContainerConfiguration(Transport, Log));
            _waiterFactory = new MessageWaiterFactory(System, Transport, DefaultTimeout);

            Initializing.Invoke(this, this);

            System.InitDomainEventsSerialization(EventsAdaptersCatalog);

            ActorTransportProxy = System.ActorOf(Props.Create(() => new LocalTransportProxyActor()), nameof(ActorTransportProxy));

            //var appInsightsConfig = AppInsightsConfigSection.Default ?? new DefaultAppInsightsConfiguration();
            //var perfCountersConfig = AppInsightsConfigSection.Default ?? new DefaultAppInsightsConfiguration();
            //
            //if(appInsightsConfig.IsEnabled)
            //{
            //    var monitor = new ActorAppInsightsMonitor(appInsightsConfig.Key);
            //    ActorMonitoringExtension.RegisterMonitor(System, monitor);
            //}
            //if(perfCountersConfig.IsEnabled)
            //    ActorMonitoringExtension.RegisterMonitor(System, new ActorPerformanceCountersMonitor());

            _commandExecutor = await CreateCommandExecutor();

            _containerBuilder.RegisterInstance(_commandExecutor);

            var domainBuilder = CreateDomainBuilder();

            domainBuilder.Configure(_containerBuilder);

            Container = _containerBuilder.Build();
            System.AddDependencyResolver(new AutoFacDependencyResolver(Container, System));
            domainBuilder.Configure(Pipe);
            var nodeController = System.ActorOf(Props.Create(() => new GridNodeController(Pipe.CommandExecutor, ActorTransportProxy)), nameof(GridNodeController));

            await nodeController.Ask <GridNodeController.Alive>(GridNodeController.HeartBeat.Instance);

            Log.Information("GridDomain node {Id} started at home {Home}", Id, System.Settings.Home);
        }
コード例 #3
0
 public StatsActorSystemService(IActorSystemFactory actorSystemFactory)
 {
     StatsActorSystem = actorSystemFactory.Create("StatsCoordinatorActor");
     statActorRef = StatsActorSystem.ActorOf(StatsActorSystem.DI().Props<StatsCoordinatorActor>()
         .WithRouter(new RoundRobinPool(2)), "StatsCoordinatorActor");
 }