public override async Task OnActivateAsync() { streamProvider = GetStreamProvider("SMSProvider"); jobManager = GrainFactory.GetGrain <IJobManagerGrain>(0, "JobManager"); var window = await jobManager.GetWindow(this.GetPrimaryKey()); window_length = window.Item1; window_slide = window.Item2; func = new WindowFunction(window_length, window_slide); // ask the JobManager which streams it should subscribe var subscribe = await jobManager.GetSubscribe(this.GetPrimaryKey()); foreach (var streamID in subscribe) { var stream = streamProvider.GetStream <MyType>(streamID, null); // To resume stream in case of stream deactivation var subscriptionHandles = await stream.GetAllSubscriptionHandles(); if (subscriptionHandles.Count > 0) { foreach (var subscriptionHandle in subscriptionHandles) { await subscriptionHandle.ResumeAsync(Process); } } // explicitly subscribe to a stream await stream.SubscribeAsync(Process); } }
public override async Task OnActivateAsync() { streamProvider = GetStreamProvider("SMSProvider"); jobManager = GrainFactory.GetGrain <IJobManagerGrain>(0, "JobManager"); delay = await jobManager.GetDelay(); // ask the JobManager which streams it should subscribe var subscribe = await jobManager.GetSubscribe(this.GetPrimaryKey()); foreach (var streamID in subscribe) { var stream = streamProvider.GetStream <string>(streamID, null); // To resume stream in case of stream deactivation var subscriptionHandles = await stream.GetAllSubscriptionHandles(); if (subscriptionHandles.Count > 0) { foreach (var subscriptionHandle in subscriptionHandles) { await subscriptionHandle.ResumeAsync(Process); } } // explicitly subscribe to a stream await stream.SubscribeAsync(Process); } }