public static StartWorkflowRequest For <T>(string workflowId) where T : Workflow { Ensure.NotNullAndEmpty(workflowId, "workflowId"); var workflowDescription = WorkflowDescription.FindOn <T>(); return(new StartWorkflowRequest(workflowDescription.Name, workflowDescription.Version, workflowId)); }
/// <summary> /// Returns the parent child-workflow for <see cref="TWorkflow"/> and positional name. Returns null if not /// </summary> /// <typeparam name="TWorkflow"></typeparam> /// <param name="workflowItem"></param> /// <param name="positionalName"></param> /// <returns></returns> public static IChildWorkflowItem ParentChildWorkflow <TWorkflow>(this IWorkflowItem workflowItem, string positionalName = "") where TWorkflow : Workflow { Ensure.NotNull(workflowItem, nameof(workflowItem)); var desc = WorkflowDescription.FindOn <TWorkflow>(); return(workflowItem.ParentChildWorkflow(desc.Name, desc.Version, positionalName)); }
private void PopulateHostedWorkflows(IEnumerable <Workflow> workflows) { foreach (var workflow in workflows) { var workflowDescription = WorkflowDescription.FindOn(workflow.GetType()); var hostedWorkflowKey = workflowDescription.Name + workflowDescription.Version; if (_workflows.ContainsKey(hostedWorkflowKey)) { throw new WorkflowAlreadyHostedException(string.Format(Resources.Workflow_already_hosted, workflowDescription.Name, workflowDescription.Version)); } _workflows.Add(hostedWorkflowKey, workflow); } }
public ChildWorkflowItem(Identity identity, IWorkflow workflow, WorkflowDescription desc) : base(identity, workflow) { Initialize(workflow); _childPolicy = w => desc.DefaultChildPolicy; _taskPriority = w => desc.DefaultTaskPriority; _lambdaRole = w => desc.DefaultLambdaRole; _taskListName = w => desc.DefaultTaskListName; _timeouts = _ => new WorkflowTimeouts() { ExecutionStartToCloseTimeout = desc.DefaultExecutionStartToCloseTimeout, TaskStartToCloseTimeout = desc.DefaultTaskStartToCloseTimeout }; }
internal static IChildWorkflowItem First <TWorkflow>(this IEnumerable <IChildWorkflowItem> items, string positionalName = "") where TWorkflow : Workflow { var desc = WorkflowDescription.FindOn <TWorkflow>(); return(items.First(desc.Name, desc.Version, positionalName)); }
public IFluentChildWorkflowItem AfterChildWorkflow <TWorkflow>(string positionalName) where TWorkflow : Workflow { var desc = WorkflowDescription.FindOn <TWorkflow>(); return(AfterChildWorkflow(desc.Name, desc.Version, positionalName)); }
/// <summary> /// Jump to child workflow. It will cause the workflow to fail if target child workflow is already active. /// </summary> /// <typeparam name="TWorkflow"></typeparam> /// <param name="positionalName"></param> /// <returns></returns> internal JumpWorkflowAction ToChildWorkflow <TWorkflow>(string positionalName = "") where TWorkflow : Workflow { var desc = WorkflowDescription.FindOn <TWorkflow>(); return(ToChildWorkflow(desc.Name, desc.Version, positionalName)); }
/// <summary> /// Returns workflow action to cancel the child workflow. /// </summary> /// <typeparam name="TWorkflow"></typeparam> /// <param name="positionalName"></param> /// <returns></returns> public WorkflowAction ForChildWorkflow <TWorkflow>(string positionalName = "") where TWorkflow : Workflow { var desc = WorkflowDescription.FindOn <TWorkflow>(); return(ForChildWorkflow(desc.Name, desc.Version, positionalName)); }
/// <summary> /// Schedule the child workflow. /// </summary> /// <typeparam name="T">Type of child workflow.</typeparam> /// <param name="positionalName">Positional parameter, if any, useful in scheduling same workflow multiple times.</param> /// <returns></returns> protected IFluentChildWorkflowItem ScheduleChildWorkflow <T>(string positionalName = "") where T : Workflow { var desc = WorkflowDescription.FindOn <T>(); return(ScheduleChildWorkflow(desc.Name, desc.Version, positionalName)); }