/// <summary> /// 消息流量统计服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IUnionClientBuilder AddTraffic <TIJT808Traffic>(this IUnionClientBuilder jT808ClientBuilder) where TIJT808Traffic : IUnionTraffic { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IUnionTraffic), typeof(TIJT808Traffic)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionTrafficServiceHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息会话通知服务(不同的消费者实例) /// </summary> /// <typeparam name="TSessionNoticeService">自定义会话通知服务</typeparam> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IUnionClientBuilder AddSessionNotice<TSessionNoticeService>(this IUnionClientBuilder jT808ClientBuilder) where TSessionNoticeService : UnionSessionNoticeService { jT808ClientBuilder.JT808Builder.Services.AddSingleton<UnionSessionNoticeService, TSessionNoticeService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService<UnionSessionNoticeHostedService>(); return jT808ClientBuilder; }
public static IUnionClientBuilder AddMsgIdHandler <TJT808MsgIdHandler>(this IUnionClientBuilder jT808ClientBuilder) where TJT808MsgIdHandler : IUnionMsgIdHandler { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IUnionMsgIdHandler), typeof(TJT808MsgIdHandler)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionMsgIdHandlerHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 转发服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <param name="configuration"></param> /// <returns></returns> public static IUnionClientBuilder AddTransmit(this IUnionClientBuilder jT808ClientBuilder, IConfiguration configuration) { jT808ClientBuilder.JT808Builder.Services.Configure <RemoteServerOptions>(configuration.GetSection("RemoteServerOptions")); jT808ClientBuilder.JT808Builder.Services.AddSingleton <UnionTransmitService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionTransmitHostedService>(); return(jT808ClientBuilder); }
public static IUnionClientBuilder AddMsgLogging <TJT808MsgLogging>(this IUnionClientBuilder jT808ClientBuilder) where TJT808MsgLogging : IUnionMsgLogging { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IUnionMsgLogging), typeof(TJT808MsgLogging)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionMsgDownLoggingHostedService>(); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionMsgUpLoggingHostedService>(); return(jT808ClientBuilder); }
/// <summary> /// 消息流量统计服务(不同的消费者实例) /// </summary> /// <param name="jT808ClientBuilder"></param> /// <returns></returns> public static IUnionClientBuilder AddTraffic(this IUnionClientBuilder jT808ClientBuilder) { jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IUnionTraffic), typeof(UnionTrafficDefault)); jT808ClientBuilder.JT808Builder.Services.AddHostedService <UnionTrafficServiceHostedService>(); return(jT808ClientBuilder); }