Package io.temporal.client
Class WorkflowOptions.Builder
- java.lang.Object
-
- io.temporal.client.WorkflowOptions.Builder
-
- Enclosing class:
- WorkflowOptions
public static final class WorkflowOptions.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkflowOptions
build()
WorkflowOptions.Builder
setContextPropagators(java.util.List<ContextPropagator> contextPropagators)
WorkflowOptions.Builder
setCronSchedule(java.lang.String cronSchedule)
WorkflowOptions.Builder
setMemo(java.util.Map<java.lang.String,java.lang.Object> memo)
Specifies additional non-indexed information in result of list workflow.WorkflowOptions.Builder
setRetryOptions(RetryOptions retryOptions)
WorkflowOptions.Builder
setSearchAttributes(java.util.Map<java.lang.String,java.lang.Object> searchAttributes)
Specifies additional indexed information in result of list workflow.WorkflowOptions.Builder
setTaskQueue(java.lang.String taskQueue)
Task queue to use for workflow tasks.WorkflowOptions.Builder
setWorkflowExecutionTimeout(java.time.Duration workflowExecutionTimeout)
The time after which workflow execution (which includes run retries and continue as new) is automatically terminated by Temporal service.WorkflowOptions.Builder
setWorkflowId(java.lang.String workflowId)
Workflow id to use when starting.WorkflowOptions.Builder
setWorkflowIdReusePolicy(io.temporal.api.enums.v1.WorkflowIdReusePolicy workflowIdReusePolicy)
Specifies server behavior if a completed workflow with the same id exists.WorkflowOptions.Builder
setWorkflowRunTimeout(java.time.Duration workflowRunTimeout)
The time after which workflow run is automatically terminated by Temporal service.WorkflowOptions.Builder
setWorkflowTaskTimeout(java.time.Duration workflowTaskTimeout)
Maximum execution time of a single Workflow Task.WorkflowOptions
validateBuildWithDefaults()
Validates that all required properties are set and fills all other with default parameters.
-
-
-
Method Detail
-
setWorkflowId
public WorkflowOptions.Builder setWorkflowId(java.lang.String workflowId)
Workflow id to use when starting. If not specified a UUID is generated. Note that it is dangerous as in case of client side retries no deduplication will happen based on the generated id. So prefer assigning business meaningful ids if possible.
-
setWorkflowIdReusePolicy
public WorkflowOptions.Builder setWorkflowIdReusePolicy(io.temporal.api.enums.v1.WorkflowIdReusePolicy workflowIdReusePolicy)
Specifies server behavior if a completed workflow with the same id exists. Note that under no conditions Temporal allows two workflows with the same namespace and workflow id run simultaneously.-
AllowDuplicateFailedOnly is a default value. It means that workflow can start if
previous run failed or was canceled or terminated.
-
AllowDuplicate allows new run independently of the previous run closure status.
-
RejectDuplicate doesn't allow new run independently of the previous run closure status.
-
setWorkflowRunTimeout
public WorkflowOptions.Builder setWorkflowRunTimeout(java.time.Duration workflowRunTimeout)
The time after which workflow run is automatically terminated by Temporal service. Do not rely on run timeout for business level timeouts. It is preferred to use in workflow timers for this purpose.
-
setWorkflowExecutionTimeout
public WorkflowOptions.Builder setWorkflowExecutionTimeout(java.time.Duration workflowExecutionTimeout)
The time after which workflow execution (which includes run retries and continue as new) is automatically terminated by Temporal service. Do not rely on execution timeout for business level timeouts. It is preferred to use in workflow timers for this purpose.
-
setWorkflowTaskTimeout
public WorkflowOptions.Builder setWorkflowTaskTimeout(java.time.Duration workflowTaskTimeout)
Maximum execution time of a single Workflow Task. In the majority of cases there is no need to change this timeout. Note that this timeout is not related to the overall Workflow duration in any way. It defines for how long the Workflow can get blocked in the case of a Workflow Worker crash.Default is 10 seconds. Maximum value allowed by the Temporal Server is 1 minute.
-
setTaskQueue
public WorkflowOptions.Builder setTaskQueue(java.lang.String taskQueue)
Task queue to use for workflow tasks. It should match a task queue specified when creating aWorker
that hosts the workflow code.
-
setRetryOptions
public WorkflowOptions.Builder setRetryOptions(RetryOptions retryOptions)
-
setCronSchedule
public WorkflowOptions.Builder setCronSchedule(java.lang.String cronSchedule)
-
setMemo
public WorkflowOptions.Builder setMemo(java.util.Map<java.lang.String,java.lang.Object> memo)
Specifies additional non-indexed information in result of list workflow. The type of value can be any object that are serializable byDataConverter
-
setSearchAttributes
public WorkflowOptions.Builder setSearchAttributes(java.util.Map<java.lang.String,java.lang.Object> searchAttributes)
Specifies additional indexed information in result of list workflow. The type of value should be basic type such as: String, Integer, Boolean, Double,LocalDateTime
-
setContextPropagators
public WorkflowOptions.Builder setContextPropagators(@Nullable java.util.List<ContextPropagator> contextPropagators)
- Parameters:
contextPropagators
- specifies the list of context propagators to use during this workflow. This list overrides the list specified onWorkflowClientOptions.getContextPropagators()
,null
means no overriding
-
build
public WorkflowOptions build()
-
validateBuildWithDefaults
public WorkflowOptions validateBuildWithDefaults()
Validates that all required properties are set and fills all other with default parameters.
-
-