public async Task <FunctionResult> TryExecuteAsync(TriggeredFunctionData input, CancellationToken cancellationToken) { var context = new FunctionInstanceFactoryContext <TTriggerValue>() { TriggerValue = (TTriggerValue)input.TriggerValue, ParentId = input.ParentId, TriggerDetails = input.TriggerDetails }; if (input.InvokeHandler != null) { context.InvokeHandler = async next => { await input.InvokeHandler(next); // NOTE: The InvokeHandler code path currently does not support flowing the return // value back to the trigger. return(null); }; } IFunctionInstance instance = _instanceFactory.Create(context); IDelayedException exception = await _executor.TryExecuteAsync(instance, cancellationToken); FunctionResult result = exception != null ? new FunctionResult(exception.Exception) : new FunctionResult(true); return(result); }
private IFunctionInstance CreateFunctionInstance(CallAndOverrideMessage message) { IFunctionDefinition function = _functionLookup.Lookup(message.FunctionId); if (function == null) { return(null); } IDictionary <string, object> objectParameters = new Dictionary <string, object>(); if (message.Arguments != null) { foreach (KeyValuePair <string, string> item in message.Arguments) { objectParameters.Add(item.Key, item.Value); } } var context = new FunctionInstanceFactoryContext { Id = message.Id, ParentId = message.ParentId, ExecutionReason = message.Reason, Parameters = objectParameters }; return(function.InstanceFactory.Create(context)); }
public IFunctionInstance Create(FunctionInstanceFactoryContext context) { IBindingSource bindingSource = new BindingSource(_binding, context.Parameters); return(new FunctionInstance(context.Id, context.ParentId, context.ExecutionReason, bindingSource, _invoker, _descriptor)); }