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); }
public async Task <bool> ExecuteAsync(BrokeredMessage value, CancellationToken cancellationToken) { Guid?parentId = ServiceBusCausalityHelper.GetOwner(value); IFunctionInstance instance = _instanceFactory.Create(value, parentId); IDelayedException exception = await _innerExecutor.TryExecuteAsync(instance, cancellationToken); return(exception == null); }
public async Task <bool> ExecuteAsync(IStorageQueueMessage value, CancellationToken cancellationToken) { Guid?parentId = QueueCausalityManager.GetOwner(value); IFunctionInstance instance = _instanceFactory.Create(value, parentId); IDelayedException exception = await _innerExecutor.TryExecuteAsync(instance, cancellationToken); return(exception == null); }
public async Task <FunctionResult> TryExecuteAsync(TriggeredFunctionData input, CancellationToken cancellationToken) { IFunctionInstance instance = _instanceFactory.Create((TTriggerValue)input.TriggerValue, input.ParentId); IDelayedException exception = await _executor.TryExecuteAsync(instance, cancellationToken); FunctionResult result = exception != null ? new FunctionResult(exception.Exception) : new FunctionResult(true); return(result); }