Beispiel #1
0
        public Actor Activate(Type type, string id, IActorRuntime runtime, Dispatcher dispatcher)
        {
            if (type == typeof(Api))
            {
                return(new Api(new ObserverCollection(), ApiWorkerFactory.Create(id)));
            }

            if (type == typeof(Topic))
            {
                return(new Topic(storage));
            }

            throw new InvalidOperationException($"Unknown actor type: {type}");
        }
Beispiel #2
0
 public Api()
 {
     timers    = new TimerService(this);
     observers = new ObserverCollection(this);
     worker    = ApiWorkerFactory.Create(() => Id);
 }
Beispiel #3
0
 public Api()
 {
     observers = new ObserverCollection();
     worker    = ApiWorkerFactory.Create(() => Id);
 }
Beispiel #4
0
 void On(Activate _)
 {
     observers = observers ?? new ObserverCollection();
     worker    = worker ?? ApiWorkerFactory.Create(Id);
 }