MyJob.cs 638 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Threading.Tasks;
  3. using GxPress.Service.Interface.ElasticSearch;
  4. using Quartz;
  5. namespace GxPress.Api.Tools
  6. {
  7. public class MyJob : IJob
  8. {
  9. public IElasticSearchService _elasticSearchService;
  10. public MyJob(IElasticSearchService elasticSearchService)
  11. {
  12. _elasticSearchService = elasticSearchService;
  13. }
  14. public async Task Execute(IJobExecutionContext context)
  15. {
  16. Console.WriteLine(DateTime.Now.ToShortTimeString());
  17. Console.WriteLine("waiting...");
  18. await _elasticSearchService.ElasticSearchData();
  19. }
  20. }
  21. }