Class ActivityOptions.Builder

  • Enclosing class:
    ActivityOptions

    public static final class ActivityOptions.Builder
    extends java.lang.Object
    • Method Detail

      • setScheduleToStartTimeout

        public 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.

        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 ActivityOptions.Builder setStartToCloseTimeout​(java.time.Duration startToCloseTimeout)
        Maximum time of a single Activity attempt.

        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 setScheduleToCloseTimeout(Duration) is not provided, then this timeout is required.

      • setTaskQueue

        public ActivityOptions.Builder setTaskQueue​(java.lang.String taskQueue)
        Task queue to use when dispatching activity task to a worker. By default, it is the same task list name the workflow was started with.
      • setDisableEagerExecution

        public ActivityOptions.Builder setDisableEagerExecution​(boolean disableEagerExecution)
        If set to true, will not request eager execution regardless of worker settings. If false, eager execution may still be disabled at the worker level or eager execution may not be requested due to lack of available slots.

        Eager activity execution means the server returns requested eager activities directly from the workflow task back to this worker which is faster than non-eager which may be dispatched to a separate worker.

        Defaults to false, meaning that eager activity execution will be requested if possible.

      • mergeMethodRetry

        public ActivityOptions.Builder mergeMethodRetry​(MethodRetry r)
        Properties that are set on this builder take precedence over ones found in the annotation.
      • validateAndBuildWithDefaults

        public ActivityOptions validateAndBuildWithDefaults()