internal ActorRuntime(ActorRuntimeOptions options, ILoggerFactory loggerFactory, ActorActivatorFactory activatorFactory)
        {
            this.options          = options;
            this.logger           = loggerFactory.CreateLogger(this.GetType());
            this.activatorFactory = activatorFactory;

            // Loop through actor registrations and create the actor manager for each one.
            // We do this up front so that we can catch initialization errors early, and so
            // that access to state can have a simple threading model.
            //
            // Revisit this if actor initialization becomes a significant source of delay for large projects.
            foreach (var actor in options.Actors)
            {
                this.actorManagers[actor.Type.ActorTypeName] = new ActorManager(
                    actor,
                    actor.Activator ?? this.activatorFactory.CreateActivator(actor.Type),
                    loggerFactory);
            }
        }
Beispiel #2
0
        internal ActorRuntime(ActorRuntimeOptions options, ILoggerFactory loggerFactory, ActorActivatorFactory activatorFactory, IActorProxyFactory proxyFactory)
        {
            this.options          = options;
            this.logger           = loggerFactory.CreateLogger(this.GetType());
            this.activatorFactory = activatorFactory;
            this.proxyFactory     = proxyFactory;

            // Loop through actor registrations and create the actor manager for each one.
            // We do this up front so that we can catch initialization errors early, and so
            // that access to state can have a simple threading model.
            //
            // Revisit this if actor initialization becomes a significant source of delay for large projects.
            foreach (var actor in options.Actors)
            {
                var daprInteractor = new DaprHttpInteractor(clientHandler: null, httpEndpoint: options.HttpEndpoint, apiToken: options.DaprApiToken, requestTimeout: null);
                this.actorManagers[actor.Type.ActorTypeName] = new ActorManager(
                    actor,
                    actor.Activator ?? this.activatorFactory.CreateActivator(actor.Type),
                    this.options.JsonSerializerOptions,
                    loggerFactory,
                    proxyFactory,
                    daprInteractor);
            }
        }