public ExternalTaskHandler(ExternalTaskConfiguration configuration, ILogger <ExternalTaskHandler <TJob> > logger) { this.configuration = configuration; this.logger = logger; var factory = new ConnectionFactory() { HostName = configuration.Host, Password = configuration.Password, UserName = configuration.User }; connection = factory.CreateConnection(); resultChannel = connection.CreateModel(); topicChannel = connection.CreateModel(); }
public static void ConfigureExternalTasks <THandler>(this IServiceCollection services, ExternalTaskConfiguration configuration) where THandler : class, IHostedService { services.AddSingleton <ExternalTaskConfiguration>(configuration); services.AddHostedService <THandler>(); }