Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-with-start #1585

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft

Update-with-start #1585

wants to merge 34 commits into from

Conversation

dandavison
Copy link
Contributor

@dandavison dandavison commented Dec 11, 2024

This PR adds an API for "update-with-start", using the MultiOperation gRPC API.

PR is in draft mode because the test suite is incomplete, but please feel free to review the API and implementation.

The following code demonstrates the API and is taken from the early-return sample:

  const startWorkflowOperation = new WithStartWorkflowOperation(transactionWorkflow, {
    workflowId,
    args: [transactionID],
    taskQueue: 'early-return',
    workflowIdConflictPolicy: 'FAIL', // required
  });

  const earlyConfirmation = await client.workflow.executeUpdateWithStart(getTransactionConfirmation, {
    startWorkflowOperation,
  });
  const wfHandle = await startWorkflowOperation.workflowHandle();
  const finalReport = await wfHandle.result();

Public API

  • New client interceptor startUpdateWithStart with interfaces WorkflowStartUpdateWithStartInput and WorkflowStartUpdateWithStartOutput
  • New class WithStartWorkflowOperation
  • WorkflowClient.executeUpdateWithStart and WorkflowClient.startUpdateWithStart

@dandavison dandavison requested a review from a team as a code owner December 11, 2024 23:41
@dandavison dandavison marked this pull request as draft December 11, 2024 23:42
response = await this.workflowService.updateWorkflowExecution(request);
} while (
response.stage < UpdateWorkflowExecutionLifecycleStage.UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix against basic Update. Previously, if waitStage=Completed we were issuing UpdateWorkflow requests after the update has reached Accepted. But that is not what we should do: we should issue UpdateWorkflow until Accepted and then switch to PollWorkflowUpdate. All other SDKs do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant