OperationChain 类

命名空间:Microsoft.Azure。Workflows.Sdk

OperationChain 表示一条有向的工作流程操作链,跟踪一个起始节点和一个或多个终点节点。 它是每次 Then() 调用的结果,支持合并共享同一根的并行分支。

用法

var trigger = WorkflowTriggers.BuiltIn.CreateHttpTrigger();
var left = trigger.Then(WorkflowActions.BuiltIn.Compose(inputs: () => "Left").WithName("Left"));
var right = trigger.Then(WorkflowActions.BuiltIn.Compose(inputs: () => "Right").WithName("Right"));

// Join two chains that share the same trigger root
var joined = left.Join(right);

// Fan-in: add an action after both branches
joined.Then(WorkflowActions.BuiltIn.Compose(inputs: () => "Merged").WithName("Merged"));

WorkflowFactory.CreateStatefulWorkflow("fanInWorkflow", trigger);

Methods

加入

将该链与另一个共享相同根操作的 操作 链结合,形成一个统一的终端节点链。 使用此方法合并独立构建的分支,然后再进行后续操作。

public OperationChain Join(OperationChain other)
名称 说明 类型 必需
其他 连接链条。 必须共用同一个起始节点。 操作链 是的
var trigger = WorkflowTriggers.BuiltIn.CreateHttpTrigger();
var branch1 = trigger.Then(WorkflowActions.BuiltIn.Compose(inputs: () => "A").WithName("BranchA"));
var branch2 = trigger.Then(WorkflowActions.BuiltIn.Compose(inputs: () => "B").WithName("BranchB"));

// Merge both branches
OperationChain merged = branch1.Join(branch2);

// Continue after both branches complete
merged.Then(WorkflowActions.BuiltIn.Response(
    responseBody: () => "Both branches done").WithName("FinalResponse"));

然后

这种类型实现 Then()IChainableNode 的方法。 请参见该页面,了解所有过载的完整文档。