Esempio n. 1
0
 public WorkerConcurrencyManager(
     IFunctionInvocationDispatcherFactory functionInvocationDispatcherFactory,
     IEnvironment environment,
     IOptions <WorkerConcurrencyOptions> workerConcurrencyOptions,
     IFunctionsHostingConfiguration functionsHostingConfigurations,
     IApplicationLifetime applicationLifetime,
     ILoggerFactory loggerFactory)
 {
     _functionInvocationDispatcherFactory = functionInvocationDispatcherFactory ?? throw new ArgumentNullException(nameof(functionInvocationDispatcherFactory));
     _environment = environment ?? throw new ArgumentNullException(nameof(environment));
     _workerConcurrencyOptions       = workerConcurrencyOptions;
     _functionsHostingConfigurations = functionsHostingConfigurations;
     _applicationLifetime            = applicationLifetime;
     _logger = loggerFactory?.CreateLogger(LogCategories.Concurrency);
 }
Esempio n. 2
0
        // Specify the "builtin binding types". These are types that are directly accesible without needing an explicit load gesture.
        // This is the set of bindings we shipped prior to binding extensibility.
        // Map from BindingType to the Assembly Qualified Type name for its IExtensionConfigProvider object.

        public ScriptHost(IOptions <JobHostOptions> options,
                          IOptions <HttpWorkerOptions> httpWorkerOptions,
                          IEnvironment environment,
                          IJobHostContextFactory jobHostContextFactory,
                          IConfiguration configuration,
                          IDistributedLockManager distributedLockManager,
                          IScriptEventManager eventManager,
                          ILoggerFactory loggerFactory,
                          IFunctionInvocationDispatcherFactory functionDispatcherFactory,
                          IFunctionMetadataManager functionMetadataManager,
                          IFileLoggingStatusManager fileLoggingStatusManager,
                          IMetricsLogger metricsLogger,
                          IOptions <ScriptJobHostOptions> scriptHostOptions,
                          ITypeLocator typeLocator,
                          IScriptHostManager scriptHostManager,
                          IDebugStateProvider debugManager,
                          IEnumerable <IScriptBindingProvider> bindingProviders,
                          IPrimaryHostStateProvider primaryHostStateProvider,
                          IJobHostMetadataProvider metadataProvider,
                          IHostIdProvider hostIdProvider,
                          IHttpRoutesManager httpRoutesManager,
                          IApplicationLifetime applicationLifetime,
                          IExtensionBundleManager extensionBundleManager,
                          ScriptSettingsManager settingsManager = null)
            : base(options, jobHostContextFactory)
        {
            _environment = environment;
            _typeLocator = typeLocator as ScriptTypeLocator
                           ?? throw new ArgumentException(nameof(typeLocator), $"A {nameof(ScriptTypeLocator)} instance is required.");

            _instanceId               = Guid.NewGuid().ToString();
            _hostOptions              = options;
            _configuration            = configuration;
            _storageConnectionString  = configuration.GetWebJobsConnectionString(ConnectionStringNames.Storage);
            _distributedLockManager   = distributedLockManager;
            _functionMetadataManager  = functionMetadataManager;
            _fileLoggingStatusManager = fileLoggingStatusManager;
            _applicationLifetime      = applicationLifetime;
            _hostIdProvider           = hostIdProvider;
            _httpRoutesManager        = httpRoutesManager;
            _isHttpWorker             = httpWorkerOptions.Value.Description != null;
            ScriptOptions             = scriptHostOptions.Value;
            _scriptHostManager        = scriptHostManager;
            FunctionErrors            = new Dictionary <string, ICollection <string> >(StringComparer.OrdinalIgnoreCase);
            EventManager              = eventManager;
            _functionDispatcher       = functionDispatcherFactory.GetFunctionDispatcher();
            _settingsManager          = settingsManager ?? ScriptSettingsManager.Instance;
            ExtensionBundleManager    = extensionBundleManager;

            _metricsLogger = metricsLogger;

            _hostLogPath = Path.Combine(ScriptOptions.RootLogPath, "Host");

            _workerRuntime = _environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName);

            _loggerFactory = loggerFactory;
            _logger        = loggerFactory.CreateLogger(LogCategories.Startup);
            Logger         = _logger;

            _debugManager             = debugManager;
            _primaryHostStateProvider = primaryHostStateProvider;
            _bindingProviders         = new List <IScriptBindingProvider>(bindingProviders);
            _metadataProvider         = metadataProvider;
            _eventSubscriptions.Add(EventManager.OfType <FunctionIndexingEvent>()
                                    .Subscribe(evt =>
            {
                HandleHostError(evt.Exception);
            }));
        }
 public WebScriptHostExceptionHandler(IApplicationLifetime applicationLifetime, ILogger <WebScriptHostExceptionHandler> logger, IFunctionInvocationDispatcherFactory functionInvocationDispatcherFactory)
 {
     _applicationLifetime = applicationLifetime ?? throw new ArgumentNullException(nameof(applicationLifetime));
     _functionInvocationDispatcherFactory = functionInvocationDispatcherFactory;
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public FunctionInvocationDispatcherShutdownManager(IFunctionInvocationDispatcherFactory functionDispatcherFactory)
 {
     _functionDispatcher = functionDispatcherFactory.GetFunctionDispatcher();
 }