コード例 #1
0
 public HeartbeatScheduleElapsedJob(StateManager stateManager, ElapsedScheduleMessage elapsedScheduleMessage, CancellationToken cancellationToken)
 {
     _client = new RestClient();
     _elapsedScheduleMessage = elapsedScheduleMessage;
     _stateManager           = stateManager;
     _cancellationToken      = cancellationToken;
 }
コード例 #2
0
        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}");
        }
コード例 #3
0
 public HealthCheckJob(JobDependencyLocator jobDependencies, ElapsedScheduleMessage elapsedScheduleMessage)
 {
     _jobDependencies        = jobDependencies;
     _elapsedScheduleMessage = elapsedScheduleMessage;
 }