【发布时间】:2022-09-29 09:30:28
【问题描述】:
我正在编写一个使用 cadence 工作流程的项目(cadence 客户端 3.6.2) 我在 2018 年观看了 maxim fateev 的 talk,其中提到节奏工作流是虚拟对象,最好不要将它们视为具有起点和终点的流程,因为它们可以始终处于活动状态。
public interface SubscriptionWorkflow {
@WorkflowMethod
void manageSubscription(String customerId);
@SignalMethod
void cancelSubscription();
@SignalMethod
void updateBillingPeriodChargeAmount(int billingPeriodChargeAmount);
@QueryMethod
String queryCustomerId();
@QueryMethod
int queryBillingPeriodNumber();
@QueryMethod
int queryBillingPeriodChargeAmount();
}
这段代码来自https://cadenceworkflow.io/docs/concepts/workflows/#example
在实施工作流时,需要指定执行StartToCloseTimoutSeconds通过这样的代码
public interface SubscriptionWorkflow {
@WorkflowMethod(executionStartToCloseTimoutSeconds = ...)
void manageSubscription(String customerId);
...
}
或者动态喜欢
WorkflowOptions options = new WorkflowOptions.Builder().setWorkflowId(...).setTaskList(...)
.setExecutionStartToCloseTimeout(...).build();
WorkflowStub workflowStub = workflowClient.newUntypedWorkflowStub(\"SubscriptionWorkflow::manageSubscription\",options);
workflowStub.start(...);
也可以从cli中传递
docker run --network=host --rm ubercadence/cli:master --do test-domain workflow start --tasklist the_default_task_list --workflow_type SubscriptionWorkflow::manageSubscription --execution_timeout 3600 --input \\\"id\\\"
似乎可以在不指定此超时的情况下启动工作流,工作流中的所有活动也是如此。
如果我希望我的工作流程实际上永远存在,有没有办法不添加超时?它的活动也一样
一般来说,拥有永远存在的工作流程是否被认为是一个糟糕的设计?
标签: cadence-workflow uber-cadence