public Task <string> Get(int id) { if (_languageWorkerChannel == null) { _languageWorkerChannel = _functionDispatcher.WorkerChannels.FirstOrDefault(); } ScriptInvocationContext invocationContext = new ScriptInvocationContext() { FunctionId = id.ToString(), InvocationId = Guid.NewGuid().ToString(), ResultSource = new TaskCompletionSource <string>() }; _languageWorkerChannel.SendInvocationRequest(invocationContext); return(invocationContext.ResultSource.Task); //return $"{id}-succeeed-{invocationContext.InvocationId}"; }
public void SendInvocationRequest_PublishesOutboundEvent() { ScriptInvocationContext scriptInvocationContext = new ScriptInvocationContext() { FunctionMetadata = GetTestFunctionsList("node").FirstOrDefault(), ExecutionContext = new ExecutionContext() { InvocationId = Guid.NewGuid(), FunctionName = "js1", FunctionAppDirectory = _scriptRootPath, FunctionDirectory = _scriptRootPath }, BindingData = new Dictionary <string, object>(), Inputs = new List <(string name, DataType type, object val)>() }; _workerChannel.SendInvocationRequest(scriptInvocationContext); var traces = _logger.GetLogMessages(); Assert.True(traces.Any(m => string.Equals(m.FormattedMessage, _expectedLogMsg))); }