public static IJT808ClientBuilder AddMsgIdHandler <TJT808UpMessageHandler>(this IJT808ClientBuilder jT808ClientBuilder) where TJT808UpMessageHandler : IJT808UpMessageHandler { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808UpMessageHandler), typeof(TJT808UpMessageHandler)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808MsgIdHandlerHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息会话通知服务 /// </summary> /// <typeparam name="TSessionNoticeService">自定义会话通知服务</typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddSessionNotice <TSessionNoticeService>(this IJT808ClientBuilder jT808ClientBuilder) where TSessionNoticeService : JT808SessionNoticeService { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808SessionNoticeService, TSessionNoticeService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808SessionNoticeHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息应答服务(不同的消费者实例) /// </summary> /// <typeparam name="TReplyMessageService">自定义消息回复服务</typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddReplyMessage <TReplyMessageHandler>(this IJT808ClientBuilder jT808ClientBuilder) where TReplyMessageHandler : JT808QueueReplyMessageHandler { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808QueueReplyMessageHandler, TReplyMessageHandler>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808ReplyMessageHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 独享转发服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <param name="configuration"></param> /// <returns></returns> public static IJT808ClientBuilder AddInprocJT808Transmit(this IJT808ClientBuilder jT808ClientBuilder, IConfiguration configuration) { jT808ClientBuilder.JT808Builder.Services.Configure <RemoteServerOptions>(configuration.GetSection("RemoteServerOptions")); jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettyTransmitService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808DotNettyTransmitHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息流量统计服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddTraffic <TIJT808Traffic>(this IJT808ClientBuilder jT808ClientBuilder) where TIJT808Traffic : IJT808Traffic { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808Traffic), typeof(TIJT808Traffic)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808TrafficServiceHostedService>(); return(jT808ClientBuilder); }
public static IJT808ClientBuilder AddJT808MsgLogging <TJT808MsgLogging>(this IJT808ClientBuilder jT808ClientBuilder) where TJT808MsgLogging : IJT808MsgLogging { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808MsgLogging), typeof(TJT808MsgLogging)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808MsgDownLoggingHostedService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808MsgUpLoggingHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// /// </summary> /// <param name="serviceDescriptors"></param> /// <param name="configuration">GetSection("JT808SessionConsumerConfig")</param> /// <returns></returns> public static IJT808ClientBuilder AddSessionConsumer(this IJT808ClientBuilder jT808ClientBuilder, IConfiguration configuration) { jT808ClientBuilder.JT808Builder.Services.Configure <JT808SessionConsumerConfig>(configuration.GetSection("JT808SessionConsumerConfig")); jT808ClientBuilder.JT808Builder.Services.TryAddSingleton <IJT808SessionConsumer, JT808SessionConsumer>(); return(jT808ClientBuilder); }
/// <summary> /// 共享消息应答服务(消费者单实例) /// </summary> /// <typeparam name="TReplyMessageService">自定义消息回复服务</typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddShareJT808ReplyMessage <TReplyMessageService>(this IJT808ClientBuilder jT808ClientBuilder) where TReplyMessageService : JT808ReplyMessageService { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808ReplyMessageService, TReplyMessageService>(); return(jT808ClientBuilder); }
/// <summary> /// 独享消息流量统计服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddInprocJT808Traffic(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettyTrafficService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808DotNettyTrafficServiceHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 共享消息会话通知服务(消费者单实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddShareJT808SessionNotice(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettySessionNoticeService>(); return(jT808ClientBuilder); }
/// <summary> /// 共享消息应答服务(消费者单实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddShareJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettyReplyMessageService>(); return(jT808ClientBuilder); }
/// <summary> /// 独享消息应答服务(不同的消费者实例) /// </summary> /// <typeparam name="TReplyMessageService">自定义消息回复服务</typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddInprocJT808ReplyMessage <TReplyMessageService>(this IJT808ClientBuilder jT808ClientBuilder) where TReplyMessageService : JT808DotNettyReplyMessageService { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettyReplyMessageService, TReplyMessageService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808DotNettyReplyMessageHostedService>(); return(jT808ClientBuilder); }
public static IJT808ClientBuilder AddClientReport(this IJT808ClientBuilder jT808ClientBuilder, Action <JT808ReportOptions> reportOptions) { jT808ClientBuilder.JT808Builder.Services.Configure(reportOptions); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808ReportHostedService>(); return(jT808ClientBuilder); }
public static IJT808ClientBuilder AddClientReport(this IJT808ClientBuilder jT808ClientBuilder, IConfiguration Configuration) { jT808ClientBuilder.JT808Builder.Services.Configure <JT808ReportOptions>(Configuration.GetSection("JT808ReportOptions")); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808ReportHostedService>(); return(jT808ClientBuilder); }
public static IJT808ClientBuilder AddMessageProducer <TJT808MessageProducer>(this IJT808ClientBuilder jT808ClientBuilder) where TJT808MessageProducer : IJT808MessageProducer { jT808ClientBuilder.JT808Builder.Services.Replace(new ServiceDescriptor(typeof(IJT808MessageProducer), typeof(TJT808MessageProducer), ServiceLifetime.Singleton)); return(jT808ClientBuilder); }
/// <summary> /// 消息应答服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddReplyMessage <TJT808ReplyMessageHandler>(this IJT808ClientBuilder jT808ClientBuilder) where TJT808ReplyMessageHandler : IJT808ReplyMessageHandler { jT808ClientBuilder.JT808Builder.Services.AddSingleton(new ServiceDescriptor(typeof(IJT808ReplyMessageHandler), typeof(TJT808ReplyMessageHandler), ServiceLifetime.Singleton)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808ReplyMessageHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息流量统计服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddTraffic(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808Traffic), typeof(JT808TrafficDefault)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808TrafficServiceHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// /// </summary> /// <param name="jT808NettyBuilder"></param> /// <param name="configuration">GetSection("JT808MsgReplyConsumerConfig")</param> /// <returns></returns> public static IJT808ClientBuilder AddMsgReplyConsumer(this IJT808ClientBuilder jT808ClientBuilder, IConfiguration configuration) { jT808ClientBuilder.JT808Builder.Services.Configure <JT808MsgReplyConsumerConfig>(configuration.GetSection("JT808MsgReplyConsumerConfig")); jT808ClientBuilder.JT808Builder.Services.Replace(new ServiceDescriptor(typeof(IJT808MsgReplyConsumer), typeof(JT808MsgReplyConsumer), ServiceLifetime.Singleton)); return(jT808ClientBuilder); }
/// <summary> /// 共享消息流量统计服务(消费者单实例) /// </summary> /// <typeparam name="TReplyMessageService"></typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddShareJT808Traffic(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808DotNettyTrafficService>(); return(jT808ClientBuilder); }
/// <summary> /// 独享消息应答服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IJT808ClientBuilder AddInprocJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton <JT808ReplyMessageService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <JT808ReplyMessageHostedService>(); return(jT808ClientBuilder); }