public static IInvoker GetFunctionInvoker(
            string language, string functionName, string moduleName, string functionHandler,
            int timeout = 180000)
        {
            FunctionCompiler.PublishTestFunction(language, functionName);

            var function = new CompiledFunction(moduleName, functionHandler, functionName);
            var invoker  = new CompiledFunctionInvoker(function, timeout);

            return(invoker);
        }
Exemple #2
0
        public static IInvoker GetFunctionInvoker(
            string language, string functionName, string moduleName, string functionHandler,
            int timeout = 180000)
        {
            FunctionCompiler.PublishTestFunction(language, functionName);
            var publishPath = Environment.GetEnvironmentVariable("PUBLISH_PATH");

            var function = new CompiledFunction(moduleName, functionHandler, publishPath, functionName);
            var invoker  = new CompiledFunctionInvoker(function, timeout, publishPath);

            return(invoker);
        }
Exemple #3
0
        public static IInvoker GetFunctionInvoker(
            string language, string functionFileName, string moduleName, string functionHandler,
            int timeout = 180000)
        {
            FunctionFactory factory      = new FunctionFactory(BASE_PATH, PACKAGES_SUBPATH);
            string          functionPath = factory.CreateEnvironmentPath(BASE_PATH, language, functionFileName);
            IFunction       function     = factory.CompileFunction(functionPath, moduleName, functionHandler);

            string   referencesPath = Path.Combine(functionPath, PACKAGES_SUBPATH);
            IInvoker invoker        = new CompiledFunctionInvoker(function, timeout, referencesPath);

            return(invoker);
        }
        private static object ExecuteCompiledFunction(IFunction function, int timeout = 180 * 1000)
        {
            // Invoke
            var invoker = new CompiledFunctionInvoker(timeout);

            var cancellationSource = new CancellationTokenSource();

            var request = WebManager.GetHttpRequest();

            (Event _event, Context _context) = new DefaultParameterHandler().GetFunctionParameters(request);

            return(invoker.Execute(function, cancellationSource, _event, _context));
        }