public static final class ActivityOptions.Builder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
ActivityOptions |
build() |
ActivityOptions.Builder |
mergeActivityOptions(ActivityOptions override) |
ActivityOptions.Builder |
mergeMethodRetry(MethodRetry r)
Properties that are set on this builder take precedence over ones found in the annotation.
|
ActivityOptions.Builder |
setCancellationType(ActivityCancellationType cancellationType)
In case of an activity cancellation it fails with a
CanceledFailure . |
ActivityOptions.Builder |
setContextPropagators(java.util.List<ContextPropagator> contextPropagators)
ContextPropagators help propagate the context from the workflow to the activities
|
ActivityOptions.Builder |
setHeartbeatTimeout(java.time.Duration heartbeatTimeoutSeconds)
Heartbeat interval.
|
ActivityOptions.Builder |
setRetryOptions(RetryOptions retryOptions)
RetryOptions that define how activity is retried in case of failure.
|
ActivityOptions.Builder |
setScheduleToCloseTimeout(java.time.Duration scheduleToCloseTimeout)
Total time that a workflow is willing to wait for Activity to complete.
|
ActivityOptions.Builder |
setScheduleToStartTimeout(java.time.Duration scheduleToStartTimeout)
Time that the Activity Task can stay in the Task Queue before it is picked up by a Worker.
|
ActivityOptions.Builder |
setStartToCloseTimeout(java.time.Duration startToCloseTimeout)
Maximum time of a single Activity execution attempt.
|
ActivityOptions.Builder |
setTaskQueue(java.lang.String taskQueue)
Task queue to use when dispatching activity task to a worker.
|
ActivityOptions |
validateAndBuildWithDefaults() |
public ActivityOptions.Builder setScheduleToCloseTimeout(java.time.Duration scheduleToCloseTimeout)
ScheduleToCloseTimeout limits the total time of an Activity's execution including retries (use StartToCloseTimeout to limit the time of a single attempt).
Either this option or StartToClose is required.
Defaults to unlimited.
public ActivityOptions.Builder setScheduleToStartTimeout(java.time.Duration scheduleToStartTimeout)
ScheduleToStartTimeout is always non-retryable. Retrying after this timeout doesn't make sense as it would just put the Activity Task back into the same Task Queue.
Defaults to unlimited.
public ActivityOptions.Builder setStartToCloseTimeout(java.time.Duration startToCloseTimeout)
Note that the Temporal Server doesn't detect Worker process failures directly. It relies
on this timeout to detect that an Activity that didn't complete on time. So this timeout
should be as short as the longest possible execution of the Activity body. Potentially long
running Activities must specify HeartbeatTimeout and call ActivityExecutionContext.heartbeat(Object)
periodically for timely failure detection.
If ScheduleToClose is not provided then this timeout is required.
Defaults to the ScheduleToCloseTimeout value.
public ActivityOptions.Builder setHeartbeatTimeout(java.time.Duration heartbeatTimeoutSeconds)
ActivityExecutionContext.heartbeat(Object)
before this interval passes after the last heartbeat or the Activity starts.public ActivityOptions.Builder setTaskQueue(java.lang.String taskQueue)
public ActivityOptions.Builder setRetryOptions(RetryOptions retryOptions)
public ActivityOptions.Builder setContextPropagators(java.util.List<ContextPropagator> contextPropagators)
public ActivityOptions.Builder setCancellationType(ActivityCancellationType cancellationType)
CanceledFailure
. If this flag is
set to false then the exception is thrown not immediately but only after an activity
completes its cleanup. If true a CanceledFailure
is thrown immediately and an
activity cancellation is going to happen in the background.public ActivityOptions.Builder mergeActivityOptions(ActivityOptions override)
public ActivityOptions.Builder mergeMethodRetry(MethodRetry r)
public ActivityOptions build()
public ActivityOptions validateAndBuildWithDefaults()