using EntrustSettle.Common;
using EntrustSettle.EventBus;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
namespace EntrustSettle.Extensions
{
///
/// 注入Kafka相关配置
///
public static class KafkaSetup
{
public static void AddKafkaSetup(this IServiceCollection services,IConfiguration configuration)
{
if (services == null) throw new ArgumentNullException(nameof(services));
if (AppSettings.app(new string[] { "Kafka", "Enabled" }).ObjToBool())
{
services.Configure(configuration.GetSection("kafka"));
services.AddSingleton();
}
}
}
}