private async Task UnsubscribeFromAttribute(DataSubscription subscription) { var series = GrainClient.GrainFactory.GetGrain <IAttributeSeriesGrain>(SeriesIdHelper.ToCalculationSeriesId(subscription.Entity, subscription.Attribute)); var observerRef = await GrainClient.GrainFactory.CreateObjectReference <ISeriesObserver>(subscription.Observer); await series.Unsubscribe(observerRef); }
private async Task <DataSubscription> SubscribeToAttribute(string socketId, DataSubscription subscription) { var series = GrainClient.GrainFactory.GetGrain <IAttributeSeriesGrain>(SeriesIdHelper.ToAttributeSeriesId(subscription.Entity, subscription.Attribute)); subscription.Observer = new SeriesObserver(socketId, this); var observerRef = await GrainClient.GrainFactory.CreateObjectReference <ISeriesObserver>(subscription.Observer); await series.Subscribe(observerRef); return(subscription); }
public override bool Equals(object obj) { DataSubscription subscription = obj as DataSubscription; return(subscription != null && subscription.Entity == Entity && subscription.Attribute == Attribute); }