コード例 #1
0
        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();
        }
コード例 #2
0
 public static void ConfigureExternalTasks <THandler>(this IServiceCollection services, ExternalTaskConfiguration configuration) where THandler : class, IHostedService
 {
     services.AddSingleton <ExternalTaskConfiguration>(configuration);
     services.AddHostedService <THandler>();
 }