public async Task Unsubscribe(IMessageObserver observer) { this.observers.Unsubscribe(observer); if (this.observers.Count == 0) { var manager = PubSubManagerFactory.GetGrain(0); await manager.Unregister(this); this.DeactivateOnIdle(); // remove this grain } }
public async override Task ActivateAsync() { this.observers = new ObserverSubscriptionManager <IMessageObserver>(); this.otherGrains = new IPubSubGrain[] { }; var manager = PubSubManagerFactory.GetGrain(0); this.otherGrains = await manager.Register(this); await base.ActivateAsync(); }
public override Task DeactivateAsync() { var manager = PubSubManagerFactory.GetGrain(0); return(manager.Unregister(this)); }