How to set a Schedule-To-Start Timeout in Java
To set a Schedule-To-Start Timeout, use ActivityOptions.newBuilder.setScheduleToStartTimeout​
.
- Type:
Duration
- Default: Unlimited. This timeout is non-retryable.
You can set Activity Options using an ActivityStub
within a Workflow implementation, or per-Activity using WorkflowImplementationOptions
within a Worker.
Note that if you define options per-Activity Type options with WorkflowImplementationOptions.setActivityOptions()
, setting them again specifically with ActivityStub
in a Workflow will override this setting.
With
ActivityStub
GreetingActivities activities = Workflow.newActivityStub(GreetingActivities.class,
ActivityOptions.newBuilder()
.setScheduleToStartTimeout(Duration.ofSeconds(5))
// note that either StartToCloseTimeout or ScheduleToCloseTimeout are
// required when setting Activity options.
.setScheduletoCloseTimeout(Duration.ofSeconds(20))
.build());With
WorkflowImplementationOptions
WorkflowImplementationOptions options =
WorkflowImplementationOptions.newBuilder()
.setActivityOptions(
ImmutableMap.of(
"GetCustomerGreeting",
ActivityOptions.newBuilder()
.setScheduleToStartTimeout(Duration.ofSeconds(5))
.build()))
.build();