示例#1
0
        internal ActorManager(
            ActorRegistration registration,
            ActorActivator activator,
            JsonSerializerOptions jsonSerializerOptions,
            ILoggerFactory loggerFactory,
            IActorProxyFactory proxyFactory,
            IDaprInteractor daprInteractor)
        {
            this.registration          = registration;
            this.activator             = activator;
            this.jsonSerializerOptions = jsonSerializerOptions;
            this.loggerFactory         = loggerFactory;
            this.proxyFactory          = proxyFactory;
            this.daprInteractor        = daprInteractor;

            this.timerManager = new DefaultActorTimerManager(this.daprInteractor);

            // map for remoting calls.
            this.methodDispatcherMap = new ActorMethodDispatcherMap(this.registration.Type.InterfaceTypes);

            // map for non-remoting calls.
            this.actorMethodInfoMap    = new ActorMethodInfoMap(this.registration.Type.InterfaceTypes);
            this.activeActors          = new ConcurrentDictionary <ActorId, ActorActivatorState>();
            this.reminderMethodContext = ActorMethodContext.CreateForReminder(ReceiveReminderMethodName);
            this.timerMethodContext    = ActorMethodContext.CreateForTimer(TimerMethodName);
            this.serializersManager    = IntializeSerializationManager(null);
            this.messageBodyFactory    = new WrappedRequestMessageFactory();

            this.logger = loggerFactory.CreateLogger(this.GetType());
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ActorHost"/> class.
 /// </summary>
 /// <param name="actorTypeInfo">The type information of the Actor.</param>
 /// <param name="id">The id of the Actor instance.</param>
 /// <param name="jsonSerializerOptions">The <see cref="JsonSerializerOptions"/> to use for actor state persistence and message deserialization.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="proxyFactory">The <see cref="ActorProxyFactory" />.</param>
 /// <param name="timerManager">The <see cref="ActorTimerManager" />.</param>
 internal ActorHost(
     ActorTypeInformation actorTypeInfo,
     ActorId id,
     JsonSerializerOptions jsonSerializerOptions,
     ILoggerFactory loggerFactory,
     IActorProxyFactory proxyFactory,
     ActorTimerManager timerManager)
 {
     this.ActorTypeInfo = actorTypeInfo;
     this.Id            = id;
     this.LoggerFactory = loggerFactory;
     this.ProxyFactory  = proxyFactory;
     this.TimerManager  = timerManager;
 }