public IFunctionInstance Create(Guid id, Guid?parentId, ExecutionReason reason, IDictionary <string, object> parameters) { IBindingSource bindingSource = new BindingSource(_binding, parameters); return(new FunctionInstance(id, parentId, reason, bindingSource, _invoker, _descriptor)); }
/// <summary>Formats a function's <see cref="ExecutionReason"/> in a display-friendly text format.</summary> /// <param name="message">The function whose reason to format.</param> /// <returns>A function's <see cref="ExecutionReason"/> in a display-friendly text format.</returns> public static string FormatReason(this FunctionStartedMessage message) { if (message == null) { throw new ArgumentNullException("message"); } ExecutionReason reason = message.Reason; // If the message already contains details use them. This will be the case for // messages serialized from the Host to the Dashboard. The host will format the // reason before sending if (!string.IsNullOrEmpty(message.ReasonDetails)) { return(message.ReasonDetails); } switch (reason) { case ExecutionReason.AutomaticTrigger: return(GetAutomaticTriggerReason(message)); case ExecutionReason.HostCall: return("This function was programmatically called via the host APIs."); case ExecutionReason.Dashboard: return(message.ParentId.HasValue ? "Replayed from Dashboard." : "Ran from Dashboard."); default: return(null); } }
public Guid TriggerAndOverride(string queueName, FunctionSnapshot function, IDictionary<string, string> arguments, Guid? parentId, ExecutionReason reason) { if (function == null) { throw new ArgumentNullException("function"); } Guid id = Guid.NewGuid(); CallAndOverrideMessage message = new CallAndOverrideMessage { Id = id, FunctionId = function.HostFunctionId, Arguments = arguments, ParentId = parentId, Reason = reason }; string functionId = new FunctionIdentifier(function.QueueName, function.HostFunctionId).ToString(); FunctionInstanceSnapshot snapshot = CreateSnapshot(id, arguments, parentId, DateTimeOffset.UtcNow, functionId, function.FullName, function.ShortName); _logger.LogFunctionQueued(snapshot); _sender.Enqueue(queueName, message); return id; }
public FunctionInstance(Guid id, Guid?parentId, ExecutionReason reason, IBindingSource bindingSource, IFunctionInvoker invoker, FunctionDescriptor functionDescriptor) { _id = id; _parentId = parentId; _reason = reason; _bindingSource = bindingSource; _invoker = invoker; _functionDescriptor = functionDescriptor; }
public FunctionInstance(Guid id, Guid? parentId, ExecutionReason reason, IBindingSource bindingSource, IFunctionInvoker invoker, FunctionDescriptor functionDescriptor) { _id = id; _parentId = parentId; _reason = reason; _bindingSource = bindingSource; _invoker = invoker; _functionDescriptor = functionDescriptor; }
public FunctionInstance(Guid id, IDictionary <string, string> triggerDetails, Guid?parentId, ExecutionReason reason, IBindingSource bindingSource, IFunctionInvoker invoker, FunctionDescriptor functionDescriptor) { _id = id; _triggerDetails = triggerDetails; _parentId = parentId; _reason = reason; _bindingSource = bindingSource; _invoker = invoker; _functionDescriptor = functionDescriptor; }
/// <summary>Format's a function's <see cref="ExecutionReason"/> in a display-friendly text format.</summary> /// <param name="message">The function whose reason to format.</param> /// <returns>A function's <see cref="ExecutionReason"/> in a display-friendly text format.</returns> public static string FormatReason(this FunctionStartedMessage message) { if (message == null) { throw new ArgumentNullException("message"); } ExecutionReason reason = message.Reason; switch (reason) { case ExecutionReason.AutomaticTrigger: return(GetAutomaticTriggerReason(message)); case ExecutionReason.HostCall: return("This was function was programmatically called via the host APIs."); case ExecutionReason.Dashboard: return(message.ParentId.HasValue ? "Replayed from Dashboard." : "Ran from Dashboard."); default: return(null); } }
private ActionResult Invoke(string queueName, FormCollection form, FunctionSnapshot function, ExecutionReason reason, Guid?parentId) { if (function == null) { return(HttpNotFound()); } IDictionary <string, string> arguments = GetArguments(form); Guid id = _invoker.TriggerAndOverride(queueName, function, arguments, parentId, reason); return(Redirect("~/#/functions/invocations/" + id)); }
public IFunctionInstance Create(Guid id, Guid? parentId, ExecutionReason reason, IDictionary<string, object> parameters) { IBindingSource bindingSource = new BindingSource(_binding, parameters); return new FunctionInstance(id, parentId, reason, bindingSource, _invoker, _descriptor); }
public Guid TriggerAndOverride(string queueName, FunctionSnapshot function, IDictionary <string, string> arguments, Guid?parentId, ExecutionReason reason) { Guid id = Guid.NewGuid(); CallAndOverrideMessage message = new CallAndOverrideMessage { Id = id, FunctionId = function.HostFunctionId, Arguments = arguments, ParentId = parentId, Reason = reason }; string functionId = new FunctionIdentifier(function.QueueName, function.HostFunctionId).ToString(); FunctionInstanceSnapshot snapshot = CreateSnapshot(id, arguments, parentId, DateTimeOffset.UtcNow, functionId, function.FullName, function.ShortName); _logger.LogFunctionQueued(snapshot); _sender.Enqueue(queueName, message); return(id); }
private ActionResult Invoke(string queueName, FormCollection form, FunctionSnapshot function, ExecutionReason reason, Guid? parentId) { if (function == null) { return HttpNotFound(); } IDictionary<string, string> arguments = GetArguments(form); Guid id = _invoker.TriggerAndOverride(queueName, function, arguments, parentId, reason); return Redirect("~/#/functions/invocations/" + id); }
public Guid TriggerAndOverride(string queueName, FunctionSnapshot function, IDictionary <string, string> arguments, Guid?parentId, ExecutionReason reason) { throw new NotImplementedException(); }