Class LocalActivityOptions.Builder

java.lang.Object
io.temporal.activity.LocalActivityOptions.Builder
Enclosing class:
LocalActivityOptions

public static final class LocalActivityOptions.Builder extends Object
  • Method Details

    • setScheduleToCloseTimeout

      public LocalActivityOptions.Builder setScheduleToCloseTimeout(Duration timeout)
      Total time that a workflow is willing to wait for an Activity to complete.

      ScheduleToCloseTimeout limits the total time of an Activity's execution including retries (use setStartToCloseTimeout(Duration) to limit the time of a single attempt).

      Either this option or setStartToCloseTimeout(Duration) is required.

      Defaults to unlimited.

    • setScheduleToStartTimeout

      public LocalActivityOptions.Builder setScheduleToStartTimeout(Duration timeout)
      Time that the Activity Task can stay in the Worker's internal Task Queue of Local Activities until it's picked up by the Local Activity Executor.

      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.

    • setStartToCloseTimeout

      public LocalActivityOptions.Builder setStartToCloseTimeout(Duration timeout)
      Maximum time of a single Activity attempt.

      If setScheduleToCloseTimeout(Duration) is not provided, then this timeout is required.

    • setLocalRetryThreshold

      public LocalActivityOptions.Builder setLocalRetryThreshold(Duration localRetryThreshold)
      Maximum time to wait between retries locally, while keeping the Workflow Task open via a Heartbeat. If the delay between the attempts becomes larger that this threshold, a Workflow Timer will be scheduled. Default value is Workflow Task Timeout multiplied by 3.
    • setRetryOptions

      public LocalActivityOptions.Builder setRetryOptions(RetryOptions retryOptions)
      RetryOptions that define how an Activity is retried in case of failure.

      If not provided, the default activity retry policy is:

      
         InitialInterval:         1 second
         BackoffCoefficient:      2
         MaximumInterval:         100 seconds   // 100 * InitialInterval
         MaximumAttempts:         0             // Unlimited
         NonRetryableErrorTypes:  []
       

      If both setScheduleToCloseTimeout(Duration) and RetryOptions.Builder.setMaximumAttempts(int) are not set, the Activity will not be retried.

      To ensure zero retries, set RetryOptions.Builder.setMaximumAttempts(int) to 1.

    • setMethodRetry

      public LocalActivityOptions.Builder setMethodRetry(MethodRetry r)
      Merges MethodRetry annotation. The values of this builder take precedence over annotated ones.
    • setDoNotIncludeArgumentsIntoMarker

      public LocalActivityOptions.Builder setDoNotIncludeArgumentsIntoMarker(boolean doNotIncludeArgumentsIntoMarker)
      When set to true, the serialized arguments of the local Activity are not included in the Marker Event that stores the local Activity's invocation result. The serialized arguments are included only for human troubleshooting as they are never read by the SDK code. In some cases, it is better to not include them to reduce the history size. The default value is set to false.
    • setSummary

      @Experimental public LocalActivityOptions.Builder setSummary(String summary)
      Single-line fixed summary for this activity that will appear in UI/CLI. This can be in single-line Temporal Markdown format.

      Default is none/empty.

    • mergeActivityOptions

      public LocalActivityOptions.Builder mergeActivityOptions(LocalActivityOptions override)
    • build

      public LocalActivityOptions build()
    • validateAndBuildWithDefaults

      public LocalActivityOptions validateAndBuildWithDefaults()