public async Task <WorkflowExecutionContext> StartWorkflowAsync(Workflow workflow, IActivity startActivity, Variables arguments, CancellationToken cancellationToken) { var workflowInstance = await workflowSerializer.DeriveAsync(workflow, cancellationToken); var workflowContext = await invoker.InvokeAsync(workflowInstance, startActivity, arguments, cancellationToken); await workflowStore.AddAsync(workflowInstance, cancellationToken); return(workflowContext); }
/// <summary> /// Invokes a workflow asynchronously using the specified input object /// as input parameters, the specified time-out interval, and a unique /// identifier. /// </summary> /// <typeparam name="TInput">The type of the input.</typeparam> /// <param name="invoker">The invoker.</param> /// <param name="inputs">The input object which is turned into a /// dictionary by <see cref="ObjectExtensions.ToDict"/>.</param> /// <param name="timeout">The interval in which the workflow must /// complete before it is aborted and a System.TimeoutException is /// thrown.</param> /// <param name="userState">A user-provided object used to distinguish /// this particular asynchronous invoke operation from other current /// asynchronous invoke operations.</param> public static void InvokeAsync <TInput>(this IWorkflowInvoker invoker, TInput inputs, TimeSpan timeout, object userState) where TInput : class { invoker.InvokeAsync(inputs.ToDict(), timeout, userState); }
/// <summary> /// Invokes a workflow asynchronously using the specified input object /// as input parameters and a unique identifier. /// </summary> /// <typeparam name="TInput">The type of the input.</typeparam> /// <param name="invoker">The invoker.</param> /// <param name="inputs">The input object which is turned into a /// dictionary by <see cref="ObjectExtensions.ToDict"/>.</param> /// <param name="userState">A user-provided object used to distinguish /// this particular asynchronous invoke operation from other current /// asynchronous invoke operations.</param> public static void InvokeAsync <TInput>(this IWorkflowInvoker invoker, TInput inputs, object userState) { invoker.InvokeAsync(inputs.ToDict(), userState); }
/// <summary> /// Invokes a workflow asynchronously using the specified input object /// as input parameters. /// </summary> /// <typeparam name="TInput">The type of the input.</typeparam> /// <param name="invoker">The invoker.</param> /// <param name="inputs">The input object which is turned into a /// dictionary by <see cref="ObjectExtensions.ToDict"/>.</param> public static void InvokeAsync <TInput>(this IWorkflowInvoker invoker, TInput inputs) where TInput : class { invoker.InvokeAsync(inputs.ToDict()); }