Closed Quinn-With-Two-Ns closed 1 month ago
WorkflowClient.updateWithStart passes workflow arguments
WorkflowClient.updateWithStart
WorkflowClient.updateWithStart does not pass workflow arguments
@Test public void startVariousFuncs() throws ExecutionException, InterruptedException { WorkflowClient workflowClient = testWorkflowRule.getWorkflowClient(); BiFunction<Functions.Func1<Integer, String>, Integer, UpdateWithStartWorkflowOperation<String>> newUpdateOp = (request, input) -> UpdateWithStartWorkflowOperation.newBuilder(request, input) .setWaitForStage(WorkflowUpdateStage.COMPLETED) .build(); // no arg TestMultiArgWorkflowFunctions.TestNoArgsWorkflowFunc stubF = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.TestNoArgsWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp0 = newUpdateOp.apply(stubF::update, 0); WorkflowUpdateHandle<String> handle0 = WorkflowClient.updateWithStart(stubF::func, updateOp0); // 1 arg TestMultiArgWorkflowFunctions.Test1ArgWorkflowFunc stubF1 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test1ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp1 = newUpdateOp.apply(stubF1::update, 1); WorkflowUpdateHandle<String> handle1 = WorkflowClient.updateWithStart(stubF1::func1, "1", updateOp1); // 2 args TestMultiArgWorkflowFunctions.Test2ArgWorkflowFunc stubF2 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test2ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp2 = newUpdateOp.apply(stubF2::update, 2); WorkflowUpdateHandle<String> handle2 = WorkflowClient.updateWithStart(stubF2::func2, "1", 2, updateOp2); // 3 args TestMultiArgWorkflowFunctions.Test3ArgWorkflowFunc stubF3 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test3ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp3 = newUpdateOp.apply(stubF3::update, 3); WorkflowUpdateHandle<String> handle3 = WorkflowClient.updateWithStart(stubF3::func3, "1", 2, 3, updateOp3); // 4 args TestMultiArgWorkflowFunctions.Test4ArgWorkflowFunc stubF4 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test4ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp4 = newUpdateOp.apply(stubF4::update, 4); WorkflowUpdateHandle<String> handle4 = WorkflowClient.updateWithStart(stubF4::func4, "1", 2, 3, 4, updateOp4); // 5 args TestMultiArgWorkflowFunctions.Test5ArgWorkflowFunc stubF5 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test5ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp5 = newUpdateOp.apply(stubF5::update, 5); WorkflowUpdateHandle<String> handle5 = WorkflowClient.updateWithStart(stubF5::func5, "1", 2, 3, 4, 5, updateOp5); // 6 args TestMultiArgWorkflowFunctions.Test6ArgWorkflowFunc stubF6 = workflowClient.newWorkflowStub( TestMultiArgWorkflowFunctions.Test6ArgWorkflowFunc.class, createOptions()); UpdateWithStartWorkflowOperation<String> updateOp6 = newUpdateOp.apply(stubF6::update, 6); WorkflowUpdateHandle<String> handle6 = WorkflowClient.updateWithStart(stubF6::func6, "1", 2, 3, 4, 5, 6, updateOp6); assertEquals("0", handle0.getResultAsync().get()); assertEquals("func", WorkflowStub.fromTyped(stubF).getResult(String.class)); assertEquals("1", handle1.getResultAsync().get()); assertEquals("1", WorkflowStub.fromTyped(stubF1).getResult(String.class)); assertEquals("2", handle2.getResultAsync().get()); assertEquals("12", WorkflowStub.fromTyped(stubF2).getResult(String.class)); assertEquals("3", handle3.getResultAsync().get()); assertEquals("123", WorkflowStub.fromTyped(stubF3).getResult(String.class)); assertEquals("4", handle4.getResultAsync().get()); assertEquals("1234", WorkflowStub.fromTyped(stubF4).getResult(String.class)); assertEquals("5", handle5.getResultAsync().get()); assertEquals("12345", WorkflowStub.fromTyped(stubF5).getResult(String.class)); assertEquals("6", handle6.getResultAsync().get()); assertEquals("123456", WorkflowStub.fromTyped(stubF6).getResult(String.class)); }
Think the issue is this line https://github.com/temporalio/sdk-java/blob/0ce1d6ec917d421d31176615f59087527b3ca27f/temporal-sdk/src/main/java/io/temporal/client/UpdateWithStartWorkflowOperation.java#L299 were we pass the update args as workflow args.
Expected Behavior
WorkflowClient.updateWithStart
passes workflow argumentsActual Behavior
WorkflowClient.updateWithStart
does not pass workflow argumentsSteps to Reproduce the Problem
Think the issue is this line https://github.com/temporalio/sdk-java/blob/0ce1d6ec917d421d31176615f59087527b3ca27f/temporal-sdk/src/main/java/io/temporal/client/UpdateWithStartWorkflowOperation.java#L299 were we pass the update args as workflow args.
Specifications