书接上文go任务调器gocron和xxl-job 我们来看看asp.netcore5.0里面怎么使用, 非常高兴有大佬们的贡献https://github.com/NanoFabricFX/DotXxlJob, 我的xxl-job是2.2.0,按照githab上我们需要安装DotXxlJob.Core然后准备代码如下:
using DotXxlJob.Core;
using DotXxlJob.Core.Model;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace WebApp
{
// 声明一个AspNet的Middleware中间件,并扩展ApplicationBuilder,本质是拦截Post请求,解析Body中的流信息
public class XxlJobExecutorMiddleware
{
private readonly IServiceProvider _provider;
private readonly RequestDelegate _next;
private readonly XxlRestfulServiceHandler _rpcService;
public XxlJobExecutorMiddleware(IServiceProvider pr