简化startup
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Options;
|
||||
using JNPF.EventHandler;
|
||||
using OnceMi.AspNetCore.OSS;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// OSS服务配置拓展.
|
||||
/// </summary>
|
||||
public static class ConfigureEventBusExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// OSS服务配置.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection ConfigureEventBus(this IServiceCollection services)
|
||||
{
|
||||
// 注册EventBus服务
|
||||
services.AddEventBus(options =>
|
||||
{
|
||||
//// 创建连接工厂
|
||||
//var factory = new RabbitMQ.Client.ConnectionFactory
|
||||
//{
|
||||
// // 设置主机名
|
||||
// HostName = "192.168.0.232",
|
||||
|
||||
// // 用户名
|
||||
// UserName = "jnpf",
|
||||
|
||||
// // 密码
|
||||
// Password = "jnpf@2019",
|
||||
//};
|
||||
|
||||
//// 创建默认内存通道事件源对象,可自定义队列路由key,比如这里是 eventbus
|
||||
//var rbmqEventSourceStorer = new RabbitMQEventSourceStorer(factory, "eventbus", 3000);
|
||||
|
||||
//// 替换默认事件总线存储器
|
||||
//options.ReplaceStorer(serviceProvider =>
|
||||
//{
|
||||
// return rbmqEventSourceStorer;
|
||||
//});
|
||||
|
||||
options.UseUtcTimestamp = false;
|
||||
|
||||
// 不启用事件日志
|
||||
options.LogEnabled = false;
|
||||
|
||||
// 事件执行器(失败重试)
|
||||
options.AddExecutor<RetryEventHandlerExecutor>();
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user