配合hangfire 周期任务暂时有问题 --待解决

This commit is contained in:
2024-10-17 13:37:57 +08:00
parent a03c11ae9d
commit f1acb787f5
9 changed files with 65 additions and 31 deletions
@@ -107,7 +107,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
dictionValue[0], // 任务类型 {5}
//dictionValue[1], // 阅片人是否同意 {6}
dictionValue[2], // 审核状态 {6}
dictionValue[3], // 是否加急 {7}
dictionValue[3] // 是否加急 {7}
);
@@ -70,7 +70,7 @@ public class TestMasstransitService : BaseService
await _mediatorScoped.Publish(new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
//await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransitHangfireTest() { value = "message at " + DateTime.Now.ToString() });
await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransiTestCommand() { value = "message at " + DateTime.Now.ToString() });
return ResponseOutput.Ok();
}
@@ -1,4 +1,5 @@
using MassTransit;
using IRaCIS.Core.Application.MassTransit.Command;
using MassTransit;
using MassTransit.Scheduling;
using System;
using System.Collections.Generic;
@@ -22,9 +23,9 @@ public abstract class IRCRecurringSchedule :
public string TimeZoneId { get; protected set; }
public DateTimeOffset StartTime { get; protected set; }
public DateTimeOffset? EndTime { get; protected set; }
public string ScheduleId { get; private set; }
public string ScheduleId { get; set; }
public string ScheduleGroup { get; private set; }
public string CronExpression { get; protected set; }
public string CronExpression { get; set; }
public string Description { get; protected set; }
}
@@ -53,4 +54,15 @@ public class ImageQCSchedule : IRCRecurringSchedule
}
public class QCImageQuestionScheduleConsumer : IConsumer<QCImageQuestionSchedule>
{
public Task Consume(ConsumeContext<QCImageQuestionSchedule> context)
{
Console.WriteLine(DateTime.Now);
return Task.CompletedTask;
}
}