From acf4c01bf1d5d7ee1ceb9bd4172bae2714ef7f3e Mon Sep 17 00:00:00 2001 From: Vathsala Ragireddy <34386917+vathsalaR@users.noreply.github.com> Date: Fri, 24 Jul 2026 10:39:09 -0700 Subject: [PATCH 1/2] Add priority setting to workflow client request --- .../temporal/internal/client/WorkflowClientRequestFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/temporal-sdk/src/main/java/io/temporal/internal/client/WorkflowClientRequestFactory.java b/temporal-sdk/src/main/java/io/temporal/internal/client/WorkflowClientRequestFactory.java index c8d9a3cca2..dbab7074a5 100644 --- a/temporal-sdk/src/main/java/io/temporal/internal/client/WorkflowClientRequestFactory.java +++ b/temporal-sdk/src/main/java/io/temporal/internal/client/WorkflowClientRequestFactory.java @@ -210,6 +210,9 @@ SignalWithStartWorkflowExecutionRequest.Builder newSignalWithStartWorkflowExecut request.setVersioningOverride(startParameters.getVersioningOverride()); } + if (startParameters.hasPriority()) { + request.setPriority(startParameters.getPriority()); + } return request; } From e9d61b9c84fc36c806cc26109d2f3e20ecd272db Mon Sep 17 00:00:00 2001 From: Vathsala Ragireddy <34386917+vathsalaR@users.noreply.github.com> Date: Fri, 24 Jul 2026 10:42:22 -0700 Subject: [PATCH 2/2] Test for setPriority --- .../temporal/workflow/PriorityInfoTest.java | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/temporal-sdk/src/test/java/io/temporal/workflow/PriorityInfoTest.java b/temporal-sdk/src/test/java/io/temporal/workflow/PriorityInfoTest.java index 339c5f1034..1779295e9f 100644 --- a/temporal-sdk/src/test/java/io/temporal/workflow/PriorityInfoTest.java +++ b/temporal-sdk/src/test/java/io/temporal/workflow/PriorityInfoTest.java @@ -6,11 +6,13 @@ import io.temporal.activity.ActivityInterface; import io.temporal.activity.ActivityOptions; import io.temporal.client.WorkflowOptions; +import io.temporal.client.WorkflowStub; import io.temporal.common.Priority; import io.temporal.testing.internal.SDKTestWorkflowRule; import io.temporal.workflow.shared.TestWorkflows; import io.temporal.workflow.shared.TestWorkflows.TestWorkflow1; import java.time.Duration; +import java.util.UUID; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -20,7 +22,10 @@ public class PriorityInfoTest { @Rule public SDKTestWorkflowRule testWorkflowRule = SDKTestWorkflowRule.newBuilder() - .setWorkflowTypes(TestPriority.class, TestPriorityChildWorkflow.class) + .setWorkflowTypes( + TestPriority.class, + TestPriorityChildWorkflow.class, + TestSignalWithStartPriorityWorkflowImpl.class) .setActivityImplementations(new PriorityActivitiesImpl()) .build(); @@ -44,6 +49,24 @@ public void testPriority() { assertEquals("5:tenant-123:2.5", result); } + @Test + public void testPriorityWithSignalWithStart() { + WorkflowStub stub = + testWorkflowRule + .getWorkflowClient() + .newUntypedWorkflowStub( + "TestSignalWithStartPriorityWorkflow", + WorkflowOptions.newBuilder() + .setWorkflowId("test-signal-with-start-priority-" + UUID.randomUUID()) + .setTaskQueue(testWorkflowRule.getTaskQueue()) + .setPriority(Priority.newBuilder().setPriorityKey(2).build()) + .build()); + stub.signalWithStart( + "mySignal", new Object[] {"signalArg"}, new Object[] {testWorkflowRule.getTaskQueue()}); + String result = stub.getResult(String.class); + assertEquals("2:null:0.0", result); + } + @ActivityInterface public interface PriorityActivities { String activity1(String a1); @@ -131,4 +154,32 @@ public String execute(String taskQueue) { + workflowPriority.getFairnessWeight(); } } + + @WorkflowInterface + public interface TestSignalWithStartPriorityWorkflow { + @WorkflowMethod + String execute(String taskQueue); + + @SignalMethod + void mySignal(String arg); + } + + public static class TestSignalWithStartPriorityWorkflowImpl + implements TestSignalWithStartPriorityWorkflow { + + private boolean received = false; + + @Override + public String execute(String taskQueue) { + Workflow.await(() -> received); + Priority priority = Workflow.getInfo().getPriority(); + String key = priority.getFairnessKey() != null ? priority.getFairnessKey() : "null"; + return priority.getPriorityKey() + ":" + key + ":" + priority.getFairnessWeight(); + } + + @Override + public void mySignal(String arg) { + received = true; + } + } }