public HeartbeatScheduleElapsedJob(StateManager stateManager, ElapsedScheduleMessage elapsedScheduleMessage, CancellationToken cancellationToken) { _client = new RestClient(); _elapsedScheduleMessage = elapsedScheduleMessage; _stateManager = stateManager; _cancellationToken = cancellationToken; }
public async Task Run() { var subscriptionId = await _jobDependencies.PublisherApiService.Subscribe(_publisher, _jobDependencies.CancellationToken); _publisher.ActualState = ActualPublisherState.Subscribed; _publisher.SubscriptionId = subscriptionId; var context = new ElapsedScheduleMessage() { Context = subscriptionId, ScheduleId = Guid.NewGuid().ToString(), JobName = Constants.JobNames.HealthCheck }; var schedulerRequest = new SchedulerRequest() { OutputName = Constants.Outputs.Subscriber, Repeat = true, RunTime = TimeSpan.FromSeconds(30), Context = context }; await _jobDependencies.SchedulerService.ScheduleJob(schedulerRequest, _jobDependencies.CancellationToken); _publisher.HealthScheduleId = context.ScheduleId; Console.Out.WriteLine($"Subscription: {subscriptionId} created for {_publisher.Id}"); }
public HealthCheckJob(JobDependencyLocator jobDependencies, ElapsedScheduleMessage elapsedScheduleMessage) { _jobDependencies = jobDependencies; _elapsedScheduleMessage = elapsedScheduleMessage; }