Esempio n. 1
0
 internal static void Reset()
 {
     ActorTypeName.Reset();
     Activator = new DefaultActorActivator();
     dispatchers.Clear();
     Conventions = null;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ActorService"/> class.
        /// </summary>
        /// <param name="context">Service context the actor service is operating under.</param>
        /// <param name="actorTypeInfo">The type information of the Actor.</param>
        /// <param name="actorFactory">The factory method to create Actor objects.</param>
        /// <param name="stateManagerFactory">The factory method to create <see cref="IActorStateManager"/></param>
        /// <param name="stateProvider">The state provider to store and access the state of the Actor objects.</param>
        /// <param name="settings">The settings used to configure the behavior of the Actor service.</param>
        public ActorService(
            StatefulServiceContext context,
            ActorTypeInformation actorTypeInfo,
            Func <ActorService, ActorId, ActorBase> actorFactory = null,
            Func <ActorBase, IActorStateProvider, IActorStateManager> stateManagerFactory = null,
            IActorStateProvider stateProvider = null,
            ActorServiceSettings settings     = null)
            : base(
                context,
                stateProvider ?? ActorStateProviderHelper.CreateDefaultStateProvider(actorTypeInfo))
        {
            this.actorTypeInformation = actorTypeInfo;
            this.stateProvider        = (IActorStateProvider)this.StateProviderReplica;
            this.settings             = ActorServiceSettings.DeepCopyFromOrDefaultOnNull(settings);

            // Set internal components
            this.actorActivator      = new ActorActivator(actorFactory ?? this.DefaultActorFactory);
            this.stateManagerFactory = stateManagerFactory ?? DefaultActorStateManagerFactory;
            this.actorManagerAdapter = new ActorManagerAdapter {
                ActorManager = new MockActorManager(this)
            };
            this.replicaRole = ReplicaRole.Unknown;
        }
Esempio n. 3
0
 internal static void Reset()
 {
     Activator = new DefaultActorActivator();
 }
Esempio n. 4
0
 internal static void Reset()
 {
     Activator = new DefaultActorActivator();
 }
Esempio n. 5
0
        internal Actor Activate(IActorHost host, ActorPath path, IActorRuntime runtime, IActorActivator activator)
        {
            var instance = activator.Activate(Class, path.Id, runtime, dispatcher);

            instance.Initialize(host, path, runtime, dispatcher);
            return(instance);
        }
Esempio n. 6
0
        public static Actor Activate(this IActorActivator activator, ActorPath path, IActorRuntime runtime)
        {
            var type = ActorType.Registered(path.Code);

            return(activator.Activate(type.Implementation, path.Id, runtime));
        }