【新增】后端分发优惠券增加按用户组分发的队列功能。

This commit is contained in:
jianweie code
2024-07-31 00:34:29 +08:00
parent aa91837c55
commit 4de1ff6021
16 changed files with 355 additions and 40 deletions

View File

@@ -12,7 +12,12 @@ namespace CoreCms.Net.Core.Config
/// </summary>
public static class RedisMessageQueueSetup
{
public static void AddRedisMessageQueueSetup(this IServiceCollection services)
/// <summary>
/// 接口端消息队列
/// </summary>
/// <param name="services"></param>
/// <exception cref="ArgumentNullException"></exception>
public static void AddRedisMessageQueueSetupForApi(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
@@ -46,5 +51,34 @@ namespace CoreCms.Net.Core.Config
m.ShowLog = false;
});
}
/// <summary>
/// 管理端消息队列
/// </summary>
/// <param name="services"></param>
/// <exception cref="ArgumentNullException"></exception>
public static void AddRedisMessageQueueSetupForAdmin(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddInitQ(m =>
{
//没消息时挂起时长(毫秒)
m.SuspendTime = 1000;
//每次消费消息间隔时间(毫秒)
m.IntervalTime = 1000;
//redis服务器地址
m.ConnectionString = AppSettingsConstVars.RedisConfigConnectionString;
//对应的订阅者类需要new一个实例对象当然你也可以传参比如日志对象
m.ListSubscribe = new List<Type>() {
typeof(CouponDistributionSubscribe),
};
//显示日志
m.ShowLog = false;
});
}
}
}