IRecurringMessageScheduler 测试使用,以及bug发现
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-10-17 21:43:39 +08:00
parent 81b9c57de7
commit 8760ad3904
8 changed files with 93 additions and 135 deletions
@@ -28,36 +28,21 @@ namespace IRaCIS.Core.API
//添加 MassTransit 和 InMemory 传输
services.AddMassTransit(cfg =>
{
// 自动扫描程序集中的消费者并进行注册
cfg.AddConsumers(typeof(UserSiteSurveySubmitedEventConsumer).Assembly);
//Uri schedulerEndpoint = new Uri("queue:scheduler");
//cfg.AddMessageScheduler(schedulerEndpoint);
cfg.AddPublishMessageScheduler();
cfg.AddHangfireConsumers();
// 使用 InMemory 作为消息传递机制
cfg.UsingInMemory((context, cfg) =>
{
//https://github.com/MassTransit/Sample-Hangfire/blob/master/src/Sample.Hangfire.Console/Program.cs
cfg.UsePublishMessageScheduler();
//cfg.UseMessageScheduler(schedulerEndpoint);
//使用 Hangfire 进行消息调度
//cfg.UseHangfireScheduler();
cfg.UseConsumeFilter(typeof(CultureInfoFilter<>), context,
x => x.Include(type => type.IsAssignableTo(typeof(DomainEvent))));
// 这里可以进行额外的配置
cfg.ConfigureEndpoints(context); // 自动配置所有消费者的端点
});
@@ -4,7 +4,6 @@ using IP2Region.Net.XDB;
using IRaCIS.Core.Application.BackGroundJob;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Application.Service.BackGroundJob;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Builder;
@@ -52,7 +51,6 @@ public static class ServiceCollectionSetup
services.AddScoped<IRepository, Repository>();
services.AddScoped<IObtainTaskAutoCancelJob, ObtainTaskAutoCancelJob>();
services.AddScoped<IIRaCISHangfireJob, IRaCISCHangfireJob>();
// 注册以Service 结尾的服务
services.Scan(scan => scan