I'm writing a project that uses cadence workflows (cadence client 3.6.2) And I was watching a talk by maxim fateev in 2018 that mentions that cadence workflows are virtual objects and it is better not to think of them as processes that have a start point and an endpoint as they can be always live.
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();
}
This section of code is from https://cadenceworkflow.io/docs/concepts/workflows/#example
When implementing a workflow it requires to specify the executionStartToCloseTimoutSeconds either by code like this
public interface SubscriptionWorkflow {
@WorkflowMethod(executionStartToCloseTimoutSeconds = ...)
void manageSubscription(String customerId);
...
}
Or dynamically like
WorkflowOptions options = new WorkflowOptions.Builder().setWorkflowId(...).setTaskList(...)
.setExecutionStartToCloseTimeout(...).build();
WorkflowStub workflowStub = workflowClient.newUntypedWorkflowStub("SubscriptionWorkflow::manageSubscription",options);
workflowStub.start(...);
And it can also be passed from the 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\"
It does seem to be possible to launch a workflow without specifying this timeout and same goes for all the activities inside the workflow.
If I wanted to the workflow in my case to actually live forever is there a way to not add a timeout? same for its activities
Is it considered a bad design to have forever living workflows in general?