using System; using System.Threading.Tasks; using GxPress.Service.Interface.ElasticSearch; using Quartz; namespace GxPress.Api.Tools { public class MyJob : IJob { public IElasticSearchService _elasticSearchService; public MyJob(IElasticSearchService elasticSearchService) { _elasticSearchService = elasticSearchService; } public async Task Execute(IJobExecutionContext context) { Console.WriteLine(DateTime.Now.ToShortTimeString()); Console.WriteLine("waiting..."); await _elasticSearchService.ElasticSearchData(); } } }