setWorkflowExecutionTimeout reliability

Hi,

I want to execute a cron job oce a day for 30 days and after this time I need to terminate de workflow execution. I read about the setWorkflowExecutionTimeout configuration, but the java documentation says " Do not rely on execution timeout for business level timeouts", I need to understand why? what is the percentage of failure?

Hope you can help me!

Workflow executions are created by the server (on client request) and WorkflowExecutionTimeout is a timeout that determines how long the execution can run (including workflow retries as well as cron executions in case of cron defs). When this timeout is reached your workflow execution is terminated / in case of cron execution the cron is stopped and no more executions are scheduled based on your cron definition.

java documentation says " Do not rely on execution timeout for business level timeouts", I need to understand why?

One of the reasons is for example that you activities can retry. The amount of retries (and the time they take) might not always the same, meaning one execution of your workflow calls activity X and gets a response right aways if a third party service it invokes is up, and another execution of the same workflow type can take much longer in the case this service is “down” and might have to retry for minutes/hours/days in some cases.
So hard-coding a workflow execution timeout and relying on it is in these cases might not be the best idea.

With the current cron implementation using WorkflowExecutionTimeout is only way (other than terminating the exec yourself) to stop cron. For your user case it seems it might be better to implement periodic execution inside your workflow code, see example here.

Note that our team is updating the cron experience and with 1.17.0 introduced schedules which will be big improvement to current cron impl. It is still experimental new feature and support for it will be added to all sdks at some point in future.

Hope this helps.

java documentation says " Do not rely on execution timeout for business level timeouts", I need to understand why?

Most business level timeouts require some actions (like cleanup) to be executed after them. Workflow timeouts terminate workflow without giving it chance to execute any application code.