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

Minor Update-with-Start fixes #3257

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/develop/go/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ if err != nil {

In [Public Preview](/evaluate/development-production-features/release-stages#public-preview) in Temporal Cloud.

Minimum Temporal Server version [Temporal Server version 1.26](https://github.com/temporalio/temporal/releases/tag/v1.26.0)
Minimum Temporal Server version [Temporal Server version 1.26](https://github.com/temporalio/temporal/releases/tag/v1.26.2)

:::

[Update-with-Start](/encyclopedia/workflow-message-passing#update-with-start) lets you
[send an Update](/develop/go/message-passing#send-update-from-client) that checks whether an already-running Workflow with that ID exists:

- If the Workflow exists, the Update is processed.
- If the Workflow does not exist, a new Workflow Execution starts with the given ID, and the Update is processed immediately after.
- If the Workflow does not exist, a new Workflow Execution is started with the given ID, and the Update is processed immediately after.

Use the [`Client.UpdateWithStartWorkflow`](https://pkg.go.dev/go.temporal.io/sdk/client#Client.UpdateWithStartWorkflow) API call.
It returns once the requested Update wait stage has been reached; or when a provided context times out.
Expand All @@ -412,8 +412,8 @@ You will need to provide:

- [`Client.NewWithStartWorkflowOperation`](https://pkg.go.dev/go.temporal.io/sdk/client#Client.NewWithStartWorkflowOperation).
Specify the workflow options, method and arguments.
Note that a `WithStartWorkflowOperation` can only be executed once.
Re-using a previously executed operation returns an error from `UpdateWithStartWorkflow`.
Note that a `WithStartWorkflowOperation` can only be used once.
Re-using a previously used operation returns an error from `UpdateWithStartWorkflow`.

The following example shows the creation, configuration, and use of UpdateWithStart:

Expand Down
8 changes: 4 additions & 4 deletions docs/develop/java/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ You can use the `WorkflowUpdateHandle` to obtain information about the update:

In [Public Preview](/evaluate/development-production-features/release-stages#public-preview) in Temporal Cloud.

Minimum Temporal Server version [Temporal Server version 1.26](https://github.com/temporalio/temporal/releases/tag/v1.26.0)
Minimum Temporal Server version [Temporal Server version 1.26](https://github.com/temporalio/temporal/releases/tag/v1.26.2)

:::

[Update-with-Start](/encyclopedia/workflow-message-passing#update-with-start) lets you
[send an Update](/develop/java/message-passing#send-update-from-client) that checks whether an already-running Workflow with that ID exists:

- If the Workflow exists, the Update is processed.
- If the Workflow does not exist, a new Workflow Execution starts with the given ID, and the Update is processed immediately after.
- If the Workflow does not exist, a new Workflow Execution is started with the given ID, and the Update is processed immediately after.

Use the [`startUpdateWithStart`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WorkflowClient.html#startUpdateWithStart(io.temporal.workflow.Functions.Func,io.temporal.client.UpdateOptions,io.temporal.client.WithStartWorkflowOperation)) WorkflowClient API.
It returns once the requested Update wait stage has been reached; or when the request times out.
Expand All @@ -420,8 +420,8 @@ You will need to provide:

- [`WithStartWorkflowOperation`](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/client/WithStartWorkflowOperation.html).
Specify the workflow method.
Note that a `WithStartWorkflowOperation` can only be executed once.
Re-using a previously executed operation returns an error from `startUpdateWithStart`.
Note that a `WithStartWorkflowOperation` can only be used once.
Re-using a previously used operation returns an error from `startUpdateWithStart`.

For example:

Expand Down
19 changes: 9 additions & 10 deletions docs/encyclopedia/application-message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,27 @@ Minimum Temporal Server version [Temporal Server version 1.26](https://github.co
:::

Update-With-Start sends an Update that checks whether an already-running Workflow with that ID exists.
If it does, the Update is processed.
If not, it starts a new Workflow Execution with the supplied ID.
When starting a new Workflow, it immediately processes the Update.
If it does, the Update is processed normally.
If not, it starts a new Workflow Execution with the supplied ID, and immediately processes the Update.

Update-With-Start is great for latency-sensitive use cases:

- **Lazy Initialization** -
Instead of making separate Start Workflow and Update Workflow calls, Update-With-Start allows you to send them together in a single roundtrip.
For example, a shopping cart can be modelled using Update-With-Start.
Updates let you add and remove items from the cart.
For example, a shopping cart can be modeled using Update-With-Start.
Updates let you add and remove items from the cart.
Update-With-Start lets the customer start shopping, whether the cart already exists or they've just started shopping.
It ensures the cart, modeled by a Workflow Execution, is created before applying any Update that changes the state of items within the cart.
It ensures the cart, modeled by a Workflow Execution, exists before applying any Update that changes the state of items within the cart.
- **Early Return** -
Using Update-With-Start can begin a new Workflow Execution and synchronously receiving a response while the Workflow Execution continues to run to completion.
Using Update-With-Start you can begin a new Workflow Execution and synchronously receive a response, while the Workflow Execution continues to run to completion.
For example, you might model a payment process using Update-With-Start.
Whether the payment completes or rolls back, you can send the payment validation results back to the client synchronously, while attempting the transaction asynchronously.
This allows you to send the payment validation results back to the client synchronously, while the transaction Workflow continues in the background.

:::caution

Unlike Signal-with-Start - Update-With-Start is *not* atomic.
If the Update can't be delivered, for example, say that there's no running Worker available, a new Workflow Execution will still start.
The SDKs will retry the Update-With-Start request but there is no guarantee that it will succeed.
If the Update can't be delivered, for example, because there's no running Worker available, a new Workflow Execution will still start.
The SDKs will retry the Update-With-Start request, but there is no guarantee that the Update will succeed.

:::

Expand Down
Loading