简体   繁体   English

我应该使用子工作流还是使用活动来启动新工作流

[英]Should I use child workflow or use activity to start new workflow

Like the title.就像标题一样。 Seems like both ways should work but child workflow seems easier.似乎这两种方式都应该有效,但子工作流程似乎更容易。

It's strongly recommended to always use activity to start new workflow and never use ChildWorkflow until the reset feature is working with Child Workflow https://github.com/uber/cadence/issues/3914强烈建议始终使用 Activity 来启动新工作流,并且在重置功能与子工作流一起使用之前永远不要使用 ChildWorkflow https://github.com/uber/cadence/issues/3914

https://github.com/temporalio/temporal/issues/3141 https://github.com/temporalio/temporal/issues/3141

To get result back to parent from child workflow, use signal.要将结果从子工作流返回给父级,请使用信号。 To link the two workflows, use search attributes when starting new workflows.要链接这两个工作流,请在启动新工作流时使用搜索属性。

As Quanzheng said, if you need to use Reset, then Child Workflows are not currently an option.正如全正所说,如果您需要使用 Reset,那么 Child Workflows 目前不是一个选项。

Apart from that issue, the semantics of Child Workflows are quite different from starting a new workflow via an Activity.除了这个问题之外,子工作流的语义与通过活动启动新工作流有很大不同。

The primary differences are that:主要区别在于:

  1. By default, Terminations and Cancellations are propagated to Child Workflows, although this can be overridden at Child Workflow creation time.默认情况下,终止和取消会传播到子工作流,尽管这可以在子工作流创建时被覆盖。 This behavior is possible to implement with co-equal Workflows, but requires a careful Workflow implementation which never terminates without terminating its children.这种行为可以通过同等的工作流来实现,但需要仔细的工作流实现,它永远不会在不终止其子级的情况下终止。
  2. Waiting for a Child Workflow to complete is directly supported in the Temporal API, whereas waiting for an arbitrary Workflow is not. Temporal API 直接支持等待子工作流完成,而等待任意工作流则不受支持。 See this issue .看到这个问题

Whether you need either of those capabilities, and whether you use Reset, should tell you if Child Workflows are appropriate to your use-case.您是否需要这些功能中的任何一个,以及您是否使用重置,应该告诉您子工作流是否适合您的用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java 客户端使用 Async.function 如果子工作流方法抛出异常,则调用子工作流无法编译 - Java client use Async.function call child workflow cannot compile if the child workflow method throws exception Uber Cadence 中的子工作流有什么好的用例? - What is a good use case for a child workflow in Uber Cadence? 使用异步活动与让工作流等待信号 - Use Asynchronous Activity vs have workflow wait for signal 如何从子工作流重新启动父工作流,或者我可以在父工作流本身内重新触发? - 节奏/时间 - How can i restart a parent workflow from child workflow or can i re-trigger within the parent workflow itself? - Cadence/ Temporal 如何从 Cadence 工作流程或活动发出自定义指标? - How can I emit custom metrics from a Cadence workflow or activity? 节奏/时间工作流中的迭代活动 - Iterative activity in Cadence / Temporal workflow 我没有工作流、工作流自动化或工作流编排 - I don't get workflow, workflow automation or workflow orchestration 您可以在 Cadence 的不同域中使用相同的工作流 id 吗? - Can you use the same workflow id in different domains in Cadence? 在节奏工作流的循环内调用相同的活动 - Invoking the same activity inside a loop in cadence workflow 如何将 workflow.Context 传递给 Cadence 活动 - How to pass workflow.Context to the Cadence activity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM