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}"); }
public Api() { timers = new TimerService(this); observers = new ObserverCollection(this); worker = ApiWorkerFactory.Create(() => Id); }
public Api() { observers = new ObserverCollection(); worker = ApiWorkerFactory.Create(() => Id); }
void On(Activate _) { observers = observers ?? new ObserverCollection(); worker = worker ?? ApiWorkerFactory.Create(Id); }