/// <summary> /// 注册相关服务 /// </summary> /// <param name="services"></param> /// <param name="option"></param> /// <returns></returns> public static IServiceCollection AddXxlJob(this IServiceCollection services, XxlJobOption option) { SingleThreadTaskExecutor.MaxTaskCount = 100000;//10万条 services .AddSingleton(option) .AddSingleton <XxlJobExecutorService>() .AddHttpClient() .AddSingleton <XxlJobMiddleware>() .AddHostedService <XxlJobStartService>() .AddSingleton <IJobHandlerManage, JobHandlerManage>() .AddSingleton <JobExecutor>() .AddSingleton <IJobHandler, HttpJobHandler>() .AddTaskExecutor(option.TaskExecutorThreadCount); return(services); }
public XxlJobExecutorService(ILogger <XxlJobExecutorService> logger, XxlJobOption xxlJobOption, IHttpClientFactory httpClientFactory, IServiceProvider serviceProvider, IJobHandlerManage jobHandlerManage, ITaskExecutor taskExecutor, JobExecutor xxlJobExecutor) { _logger = logger; _xxlJobOption = xxlJobOption; _httpClientFactory = httpClientFactory; _serviceProvider = serviceProvider; _jobHandlerManage = jobHandlerManage; _taskExecutor = taskExecutor; _xxlJobExecutor = xxlJobExecutor; }
public XxlJobMiddleware(ILogger <XxlJobMiddleware> logger, XxlJobOption xxlJobOption) { _logger = logger; _xxlJobOption = xxlJobOption; }