Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat!(client): Make workflowId required #387

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

Merged
merged 1 commit into from
Nov 12, 2021
Merged

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Nov 12, 2021

This also removes the WorkflowClientOptions.workflowDefaults.

Reasoning:

  • Workflow IDs should represent a meaningful business ID
  • Workflow IDs can be used as an idempotency key when starting workflows from an external signal
  • workflowDefaults were removed because their presence made taskQueue optional in WorkflowOptions, omitting it from both the defaults and options resulted in runtime errors where we could have caught those at compile time.\

Migration:

// Before
const client = new WorkflowClient(conn.service, { workflowDefaults: { taskQueue: 'example' } });
const handle = await client.start(myWorkflow, { args: [foo, bar] });
// After
const client = new WorkflowClient(conn.service);
const handle = await client.start(myWorkflow, {
  args: [foo, bar],
  taskQueue: 'example',
  workflowId: 'a-meaningful-business-id',
});

@bergundy bergundy added this to the beta milestone Nov 12, 2021
@bergundy bergundy requested a review from swyxio November 12, 2021 22:02
@bergundy bergundy self-assigned this Nov 12, 2021
Comment on lines +89 to +93
* Workflow id to use when starting. If not specified a UUID is generated. Note that it is
* dangerous as in case of client side retries no deduplication will happen based on the
* generated id. So prefer assigning business meaningful ids if possible.
*/
workflowId?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

still making this optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just for child workflows as discussed

@bergundy bergundy enabled auto-merge (squash) November 12, 2021 22:25
@bergundy bergundy merged commit 917be76 into main Nov 12, 2021
@bergundy bergundy deleted the required-workflow-id branch November 12, 2021 22:43
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.

2 participants