public async Task PublishCrontabAsync(Type messageType, object message, CrontabJobInfo crontabJobInfo) { var isExsits = await _redisStorage.ExistsCrontabJob(crontabJobInfo.JobId); AssertUtils.IsTrue(isExsits == false, $"该定时任务已存在 jobId={crontabJobInfo.JobId}"); //传入redis即可 var crontabJobData = new CrontabJobData { JobId = crontabJobInfo.JobId, JobName = crontabJobInfo.JobName, CrontabExpression = crontabJobInfo.CrontabExpression, Data = _options.Serializer.Serialize(message), Topic = GetTopic(messageType), Status = (int)crontabJobInfo.Status }; var result = await _redisStorage.EnqueueCrontab(crontabJobData); AssertUtils.IsTrue(result, $"redis生产定时任务失败,topic:{crontabJobData.Topic}"); }