Skip to content

Commit ffa355e

Browse files
Make sure workflow options from proxy call are propagated
1 parent c8a27ce commit ffa355e

File tree

3 files changed

+200
-159
lines changed

3 files changed

+200
-159
lines changed

Diff for: temporal-sdk/src/main/java/io/temporal/internal/common/InternalUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static WorkflowStub createNexusBoundStub(
7575
}
7676
WorkflowOptions options = stub.getOptions().get();
7777
WorkflowOptions.Builder nexusWorkflowOptions =
78-
WorkflowOptions.newBuilder()
78+
WorkflowOptions.newBuilder(options)
7979
.setRequestId(request.getRequestId())
8080
.setCompletionCallbacks(
8181
Arrays.asList(

Diff for: temporal-sdk/src/test/java/io/temporal/workflow/nexus/AsyncWorkflowOperationTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import org.junit.Test;
3636

3737
public class AsyncWorkflowOperationTest extends BaseNexusTest {
38+
private static final String WORKFLOW_ID_PREFIX = "test-prefix";
39+
3840
@Rule
3941
public SDKTestWorkflowRule testWorkflowRule =
4042
SDKTestWorkflowRule.newBuilder()
@@ -86,6 +88,7 @@ public String execute(String input) {
8688
Assert.assertTrue("Operation id should be present", asyncExec.getOperationId().isPresent());
8789
// Result should only be completed if the operation is completed
8890
Assert.assertFalse("Result should not be completed", asyncOpHandle.getResult().isCompleted());
91+
Assert.assertTrue(asyncExec.getOperationId().get().startsWith(WORKFLOW_ID_PREFIX));
8992
// Unblock the operation
9093
Workflow.newExternalWorkflowStub(OperationWorkflow.class, asyncExec.getOperationId().get())
9194
.unblock();
@@ -129,7 +132,9 @@ public OperationHandler<String, String> operation() {
129132
(context, details, client, input) ->
130133
client.newWorkflowStub(
131134
OperationWorkflow.class,
132-
WorkflowOptions.newBuilder().setWorkflowId(details.getRequestId()).build())
135+
WorkflowOptions.newBuilder()
136+
.setWorkflowId(WORKFLOW_ID_PREFIX + details.getRequestId())
137+
.build())
133138
::execute);
134139
}
135140
}

0 commit comments

Comments
 (0)