public void RegisterComittedRoutine(string routineIntentId, IFabricConnector fabricConnector, ActiveRoutineInfo routineInfo) { lock (_committedRoutines) { _committedRoutines.Add(routineIntentId, new FabricConnectorAndRoutineInfo { FabricConnector = fabricConnector, RoutineInfo = routineInfo }); } }
private async Task <ActiveRoutineInfo> PollRoutineAsync( ActiveRoutineInfo routineInfo, IFabricConnector connector, DateTimeOffset requestStartTime, TimeSpan maxPollTime, CancellationToken ct) { var stopPollingAt = requestStartTime + maxPollTime; for (var i = 0; ; i++) { routineInfo = await connector.PollRoutineResultAsync(routineInfo, ct); if (routineInfo.Result != null) { break; } TimeSpan delayInterval; if (routineInfo is IRoutinePollInterval routinePollInterval) { delayInterval = routinePollInterval.Suggest(i); } else { delayInterval = TimeSpan.FromSeconds(0.5); } var resumeAt = DateTimeOffset.Now + delayInterval; if (resumeAt > stopPollingAt) { delayInterval = stopPollingAt - DateTimeOffset.Now; } if (delayInterval <= TimeSpan.Zero) { break; } await Task.Delay(delayInterval); } return(routineInfo); }
public Task OnEventSubscriberAddedAsync(EventDescriptor eventDesc, EventSubscriberDescriptor subscriber, IFabricConnector subsriberFabricConnector) { var configuration = (FileBasedFabricConnectorConfiguration)((IFabricConnectorWithConfiguration)subsriberFabricConnector).Configuration; var subscriberEventsDirectory = configuration.EventsDirectory; var observers = ReadEventObservers(); if (observers.Add(subscriberEventsDirectory)) { WriteEventObservers(observers); } return(Task.FromResult(0)); }
public Task SubscribeForEventAsync(EventDescriptor eventDesc, EventSubscriberDescriptor subscriber, IFabricConnector publisherFabricConnector) { _addEventListener(eventDesc, subscriber); return(Task.FromResult(0)); }
public Task OnEventSubscriberAddedAsync(EventDescriptor eventDesc, EventSubscriberDescriptor subscriber, IFabricConnector subsriberFabricConnector) { throw new NotImplementedException(); }
public Task SubscribeForEventAsync(EventDescriptor eventDesc, EventSubscriberDescriptor subscriber, IFabricConnector publisherFabricConnector) { throw new NotImplementedException(); }
public Task OnEventSubscriberAddedAsync(EventDescriptor eventDesc, EventSubscriberDescriptor subscriber, IFabricConnector subsriberFabricConnector) { return(Task.FromResult(0)); }