Expected Behavior
WorkerOptions.validateAndBuildWithDefaults should check if pollerAutoscaling is set before setting the default value for maxConcurrentPollers
Actual Behavior
WorkerOptions.validateAndBuildWithDefaults sets maxConcurrentPollers to the default value regardless of whether pollerAutoscalingBehaviour is set, resulting in a validation error when constructing the new worker
Steps to Reproduce the Problem
public class HelloMain {
static final String TASK_QUEUE = "HelloActivityPluginTaskQueue";
public static void main(String[] args) {
WorkflowServiceStubs service =
WorkflowServiceStubs.newLocalServiceStubs();
WorkflowClient client =
WorkflowClient.newInstance(
service);
WorkerFactory factory = WorkerFactory.newInstance(client);
WorkerOptions.Builder builder = WorkerOptions.newBuilder();
builder.setWorkflowTaskPollersBehavior(new PollerBehaviorAutoscaling());
var validated = builder.validateAndBuildWithDefaults();
System.out.println("getMaxConcurrentWorkflowTaskPollers: " + validated.getMaxConcurrentWorkflowTaskPollers());
System.out.println("getWorkflowTaskPollersBehavior: " + validated.getWorkflowTaskPollersBehavior());
factory.newWorker(TASK_QUEUE, validated);
}
}
Output:
getMaxConcurrentWorkflowTaskPollers: 5
getWorkflowTaskPollersBehavior: PollerBehaviorAutoscaling{minConcurrentTaskPollers=1, maxConcurrentTaskPollers=100, initialConcurrentTaskPollers=5}
Exception in thread "main" java.lang.IllegalStateException: workflowTaskPollersBehavior and maxConcurrentWorkflowTaskPollers are mutually exclusive
at com.google.common.base.Preconditions.checkState(Preconditions.java:512)
at io.temporal.worker.WorkerOptions$Builder.validateAndBuildWithDefaults(WorkerOptions.java:612)
at io.temporal.worker.Worker.<init>(Worker.java:76)
at io.temporal.worker.WorkerFactory.newWorker(WorkerFactory.java:154)
at io.temporal.samples.hello.HelloMain.main(HelloMain.java:44)
Expected Behavior
WorkerOptions.validateAndBuildWithDefaults should check if pollerAutoscaling is set before setting the default value for maxConcurrentPollers
Actual Behavior
WorkerOptions.validateAndBuildWithDefaults sets maxConcurrentPollers to the default value regardless of whether pollerAutoscalingBehaviour is set, resulting in a validation error when constructing the new worker
Steps to Reproduce the Problem
Output: