Пример #1
0
 public static IMotorHostBuilder ConfigureMultiOutputService <TInput, TOutput>(
     this IMotorHostBuilder hostBuilder)
     where TOutput : class
     where TInput : class
 {
     return(hostBuilder
            .ConfigureNoOutputService <TInput>()
            .ConfigureServices((hostContext, services) =>
     {
         services.AddTransient <INoOutputService <TInput>, MultiOutputServiceAdapter <TInput, TOutput> >();
     }));
 }
Пример #2
0
 public static IMotorHostBuilder ConfigureTimer(this IMotorHostBuilder hostBuilder,
                                                string configSection = "Timer")
 {
     return(hostBuilder
            .ConfigureNoOutputService <IJobExecutionContext>()
            .ConfigureServices((hostContext, services) =>
     {
         var config = hostContext.Configuration.GetSection(configSection);
         services.Configure <TimerConfig>(config);
         services.AddHostedService <Timer>();
     }));
 }
Пример #3
0
 public static IMotorHostBuilder ConfigureMultiOutputService <TInput, TOutput>(
     this IMotorHostBuilder hostBuilder,
     string healthCheckConfigSection                = "HealthChecks",
     string messageProcessingHealthCheckName        = nameof(MessageProcessingHealthCheck <TInput>),
     string tooManyTemporaryFailuresHealthCheckName = nameof(TooManyTemporaryFailuresHealthCheck <TInput>))
     where TOutput : class
     where TInput : class
 {
     return(hostBuilder
            .ConfigureNoOutputService <TInput>(
                healthCheckConfigSection,
                messageProcessingHealthCheckName,
                tooManyTemporaryFailuresHealthCheckName)
            .ConfigureServices((_, services) =>
     {
         services.AddTransient <INoOutputService <TInput>, MultiOutputServiceAdapter <TInput, TOutput> >();
     }));
 }