public static final class WorkerOptions.Builder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
WorkerOptions |
build() |
WorkerOptions.Builder |
setActivityPollThreadCount(int activityPollThreadCount)
Number of simultaneous poll requests on activity task queue.
|
WorkerOptions.Builder |
setDefaultDeadlockDetectionTimeout(long defaultDeadlockDetectionTimeoutMs) |
WorkerOptions.Builder |
setLocalActivityWorkerOnly(boolean localActivityWorkerOnly)
If set to true worker would only handle workflow tasks and local activities.
|
WorkerOptions.Builder |
setMaxConcurrentActivityExecutionSize(int maxConcurrentActivityExecutionSize) |
WorkerOptions.Builder |
setMaxConcurrentLocalActivityExecutionSize(int maxConcurrentLocalActivityExecutionSize) |
WorkerOptions.Builder |
setMaxConcurrentWorkflowTaskExecutionSize(int maxConcurrentWorkflowTaskExecutionSize) |
WorkerOptions.Builder |
setMaxTaskQueueActivitiesPerSecond(double maxTaskQueueActivitiesPerSecond)
Optional: Sets the rate limiting on number of activities that can be executed per second.
|
WorkerOptions.Builder |
setMaxWorkerActivitiesPerSecond(double maxWorkerActivitiesPerSecond) |
WorkerOptions.Builder |
setWorkflowPollThreadCount(int workflowPollThreadCount)
Number of simultaneous poll requests on workflow task queue.
|
WorkerOptions |
validateAndBuildWithDefaults() |
public WorkerOptions.Builder setMaxWorkerActivitiesPerSecond(double maxWorkerActivitiesPerSecond)
maxWorkerActivitiesPerSecond
- Maximum number of activities started per second by this
worker. Default is 0 which means unlimited.this
If worker is not fully loaded while tasks are backing up on the service consider
increasing setActivityPollThreadCount(int)
.
Note that this is a per worker limit. Use setMaxTaskQueueActivitiesPerSecond(double)
to set per task queue limit across multiple
workers.
public WorkerOptions.Builder setMaxConcurrentActivityExecutionSize(int maxConcurrentActivityExecutionSize)
maxConcurrentActivityExecutionSize
- Maximum number of activities executed in parallel.
Default is 200, which is chosen if set to zero.this
public WorkerOptions.Builder setMaxConcurrentWorkflowTaskExecutionSize(int maxConcurrentWorkflowTaskExecutionSize)
maxConcurrentWorkflowTaskExecutionSize
- Maximum number of simultaneously executed
workflow tasks. Default is 200, which is chosen if set to zero.this
Note that this is not related to the total number of open workflows which do not need to be loaded in a worker when they are not making state transitions.
public WorkerOptions.Builder setMaxConcurrentLocalActivityExecutionSize(int maxConcurrentLocalActivityExecutionSize)
maxConcurrentLocalActivityExecutionSize
- Maximum number of local activities executed in
parallel. Default is 200, which is chosen if set to zero.this
public WorkerOptions.Builder setMaxTaskQueueActivitiesPerSecond(double maxTaskQueueActivitiesPerSecond)
public WorkerOptions.Builder setWorkflowPollThreadCount(int workflowPollThreadCount)
WorkerFactoryOptions.Builder.setWorkflowHostLocalPollThreadCount(int)
before this one.
Default is 2.
public WorkerOptions.Builder setActivityPollThreadCount(int activityPollThreadCount)
Default is 5.
public WorkerOptions.Builder setLocalActivityWorkerOnly(boolean localActivityWorkerOnly)
Default is false.
public WorkerOptions.Builder setDefaultDeadlockDetectionTimeout(long defaultDeadlockDetectionTimeoutMs)
defaultDeadlockDetectionTimeoutMs
- time period in ms that will be used the detect
workflows deadlock. Default is 1000ms, which is chosen if set to zero.
Specifies an amount of time in milliseconds that workflow tasks are allowed to execute without interruption. If workflow task runs longer than specified interval without yielding (like calling an Activity), it will fail automatically.
this
PotentialDeadlockException
public WorkerOptions build()
public WorkerOptions validateAndBuildWithDefaults()