public HotWorker(IOptions <WorkerOptions> backgroundWorkerOptions, IHotRepository hots, IHttpClientFactory httpClient, ILocalEventBus localEventBus) { _hots = hots; _httpClient = httpClient; _localEventBus = localEventBus; JobDetail = JobBuilder.Create <HotWorker>().WithIdentity(nameof(HotWorker)).Build(); Trigger = TriggerBuilder.Create() .WithIdentity(nameof(HotWorker)) .WithCronSchedule(backgroundWorkerOptions.Value.Cron) .Build(); ScheduleJob = async scheduler => { if (!await scheduler.CheckExists(JobDetail.Key)) { await scheduler.ScheduleJob(JobDetail, Trigger); } }; }
public HotService(IHotRepository hots, IHotCacheService cache) { _hots = hots; _cache = cache; }