示例#1
0
 internal DefaultHttpWorkerService(HttpClient httpClient, IOptions <HttpWorkerOptions> httpWorkerOptions, ILogger logger, IEnvironment environment)
 {
     _httpClient           = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _httpWorkerOptions    = httpWorkerOptions.Value ?? throw new ArgumentNullException(nameof(httpWorkerOptions.Value));
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _enableRequestTracing = environment.IsCoreTools();
 }
        internal string GetPathValue(HttpWorkerOptions httpWorkerOptions, string functionName, HttpRequest httpRequest)
        {
            string pathValue = functionName;

            if (httpWorkerOptions.EnableForwardingHttpRequest && httpWorkerOptions.Type == CustomHandlerType.Http)
            {
                pathValue = httpRequest.GetRequestUri().AbsolutePath;
            }

            return(pathValue);
        }
 internal DefaultHttpWorkerService(HttpClient httpClient, IOptions <HttpWorkerOptions> httpWorkerOptions, ILogger logger, IEnvironment environment, IOptions <ScriptJobHostOptions> scriptHostOptions)
 {
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _httpClient           = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _httpWorkerOptions    = httpWorkerOptions.Value ?? throw new ArgumentNullException(nameof(httpWorkerOptions.Value));
     _enableRequestTracing = environment.IsCoreTools();
     if (scriptHostOptions.Value.FunctionTimeout == null)
     {
         _logger.JobHostFunctionTimeoutNotSet();
         // Default to MaxValue if FunctionTimeout is not set in host.json or is set to -1.
         _httpClient.Timeout = TimeSpan.FromMilliseconds(int.MaxValue);
     }
     else
     {
         // Set 1 minute greater than FunctionTimeout to ensure invoction failure due to timeout is raised before httpClient raises operation cancelled exception
         _httpClient.Timeout = scriptHostOptions.Value.FunctionTimeout.Value.Add(TimeSpan.FromMinutes(1));
     }
 }
 internal HttpWorkerProcess(string workerId,
                            string rootScriptPath,
                            HttpWorkerOptions httpWorkerOptions,
                            IScriptEventManager eventManager,
                            IWorkerProcessFactory processFactory,
                            IProcessRegistry processRegistry,
                            ILogger workerProcessLogger,
                            IWorkerConsoleLogSource consoleLogSource)
     : base(eventManager, processRegistry, workerProcessLogger, consoleLogSource)
 {
     _processFactory         = processFactory;
     _eventManager           = eventManager;
     _workerProcessLogger    = workerProcessLogger;
     _workerId               = workerId;
     _scriptRootPath         = rootScriptPath;
     _httpWorkerOptions      = httpWorkerOptions;
     _workerProcessArguments = _httpWorkerOptions.Arguments;
 }
示例#5
0
 internal HttpWorkerProcess(string workerId,
                            string rootScriptPath,
                            HttpWorkerOptions httpWorkerOptions,
                            IScriptEventManager eventManager,
                            IWorkerProcessFactory processFactory,
                            IProcessRegistry processRegistry,
                            ILogger workerProcessLogger,
                            IWorkerConsoleLogSource consoleLogSource,
                            IEnvironment environment,
                            IMetricsLogger metricsLogger)
     : base(eventManager, processRegistry, workerProcessLogger, consoleLogSource, metricsLogger, httpWorkerOptions.Description.UseStdErrorStreamForErrorsOnly)
 {
     _processFactory         = processFactory;
     _eventManager           = eventManager;
     _workerProcessLogger    = workerProcessLogger;
     _workerId               = workerId;
     _scriptRootPath         = rootScriptPath;
     _httpWorkerOptions      = httpWorkerOptions;
     _workerProcessArguments = _httpWorkerOptions.Arguments;
     _environment            = environment;
 }
示例#6
0
        public IWorkerProcess Create(string workerId, string scriptRootPath, HttpWorkerOptions httpWorkerOptions)
        {
            ILogger workerProcessLogger = _loggerFactory.CreateLogger($"Worker.HttpWorkerProcess.{workerId}");

            return(new HttpWorkerProcess(workerId, scriptRootPath, httpWorkerOptions, _eventManager, _workerProcessFactory, _processRegistry, workerProcessLogger, _consoleLogSource, _environment, _metricsLogger, _serviceProvider));
        }
示例#7
0
 internal DefaultHttpWorkerService(HttpClient httpClient, IOptions <HttpWorkerOptions> httpWorkerOptions, ILoggerFactory loggerFactory)
 {
     _httpClient        = httpClient;
     _httpWorkerOptions = httpWorkerOptions.Value;
     _logger            = loggerFactory.CreateLogger <DefaultHttpWorkerService>();
 }
 internal DefaultHttpWorkerService(HttpClient httpClient, IOptions <HttpWorkerOptions> httpWorkerOptions, ILogger logger)
 {
     _httpClient        = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _httpWorkerOptions = httpWorkerOptions.Value ?? throw new ArgumentNullException(nameof(httpWorkerOptions.Value));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
示例#9
0
 internal DefaultHttpWorkerService(HttpClient httpClient, IOptions <HttpWorkerOptions> httpWorkerOptions, ILogger logger)
 {
     _httpClient        = httpClient;
     _httpWorkerOptions = httpWorkerOptions.Value;
     _logger            = logger;
 }