-
Notifications
You must be signed in to change notification settings - Fork 224
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
maintenance: yarn format on repo #3116
Open
jsundai
wants to merge
3
commits into
main
Choose a base branch
from
yarn-format-maintenance
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,7 +182,7 @@ public class GreetingWorkflow | |
// ... | ||
``` | ||
|
||
- The Update attribute can take arguments (like, `Name`, `Dynamic` and `UnfinishedPolicy`) as described in the API reference docs for [`WorkflowUpdateAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowUpdateAttribute.html). | ||
- The Update attribute can take arguments (like, `Name`, `Dynamic` and `UnfinishedPolicy`) as described in the API reference docs for [`WorkflowUpdateAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowUpdateAttribute.html). | ||
|
||
- About validators: | ||
- Use validators to reject an Update before it is written to History. | ||
|
@@ -281,6 +281,7 @@ public class WorkflowB | |
``` | ||
|
||
When an External Signal is sent: | ||
|
||
- A [SignalExternalWorkflowExecutionInitiated](/references/events#signalexternalworkflowexecutioninitiated) Event appears in the sender's Event History. | ||
- A [WorkflowExecutionSignaled](/references/events#workflowexecutionsignaled) Event appears in the recipient's Event History. | ||
|
||
|
@@ -313,31 +314,31 @@ Also note that you can't send Updates to other Workflow Executions or perform an | |
To send an Update to a Workflow Execution, you can: | ||
|
||
- Call the Update method with `ExecuteUpdateAsync` from the Client and wait for the Update to complete. | ||
This code fetches an Update result: | ||
|
||
```csharp | ||
var previousLanguage = await workflowHandle.ExecuteUpdateAsync( | ||
wf => wf.SetCurrentLanguageAsync(GreetingWorkflow.Language.Chinese)); | ||
``` | ||
This code fetches an Update result: | ||
|
||
```csharp | ||
var previousLanguage = await workflowHandle.ExecuteUpdateAsync( | ||
wf => wf.SetCurrentLanguageAsync(GreetingWorkflow.Language.Chinese)); | ||
``` | ||
- 2. Use `StartUpdateAsync` to receive a handle as soon as the Update is accepted or rejected | ||
It returns an `UpdateHandle` | ||
It returns an `UpdateHandle` | ||
|
||
- Use this `UpdateHandle` later to fetch your results. | ||
- Asynchronous Update handlers normally perform long-running async Activities. | ||
- `StartUpdateAsync` only waits until the Worker has accepted or rejected the Update, not until all asynchronous operations are complete. | ||
- Use this `UpdateHandle` later to fetch your results. | ||
- Asynchronous Update handlers normally perform long-running async Activities. | ||
- `StartUpdateAsync` only waits until the Worker has accepted or rejected the Update, not until all asynchronous operations are complete. | ||
|
||
For example: | ||
For example: | ||
|
||
```csharp | ||
// Wait until the update is accepted | ||
var updateHandle = await workflowHandle.StartUpdateAsync( | ||
wf => wf.SetGreetingAsync(new HelloWorldInput("World"))); | ||
// Wait until the update is completed | ||
var updateResult = await updateHandle.GetResultAsync(); | ||
``` | ||
```csharp | ||
// Wait until the update is accepted | ||
var updateHandle = await workflowHandle.StartUpdateAsync( | ||
wf => wf.SetGreetingAsync(new HelloWorldInput("World"))); | ||
// Wait until the update is completed | ||
var updateResult = await updateHandle.GetResultAsync(); | ||
``` | ||
|
||
For more details, see the "Async handlers" section. | ||
For more details, see the "Async handlers" section. | ||
|
||
:::info NON-TYPE SAFE API CALLS | ||
|
||
|
@@ -356,8 +357,6 @@ Use non-type safe overloads of these APIs: | |
- [`TemporalClient.GetWorkflowHandle`](https://dotnet.temporal.io/api/Temporalio.Client.TemporalClient.html#Temporalio_Client_TemporalClient_GetWorkflowHandle_System_String_System_String_System_String_) | ||
- [`Workflow.GetExternalWorkflowHandle`](https://dotnet.temporal.io/api/Temporalio.Workflows.Workflow.html#Temporalio_Workflows_Workflow_GetExternalWorkflowHandle_System_String_System_String_) | ||
|
||
|
||
|
||
::: | ||
|
||
## Message handler patterns {#message-handler-patterns} | ||
|
@@ -407,7 +406,6 @@ public class MyActivities | |
|
||
The following code modifies a `WorkflowUpdate` for asynchronous use of the preceding Activity: | ||
|
||
|
||
```csharp | ||
[Workflow] | ||
public class GreetingWorkflow | ||
|
@@ -479,12 +477,12 @@ Consider a `ReadyForUpdateToExecute` method that runs before your Update handler | |
The [`Workflow.WaitConditionAsync`](https://dotnet.temporal.io/api/Temporalio.Workflows.Workflow.html?#Temporalio_Workflows_Workflow_WaitConditionAsync_System_Func_System_Boolean__System_Int32_System_Nullable_System_Threading_CancellationToken__) call waits until your condition is met: | ||
|
||
```csharp | ||
[WorkflowUpdate] | ||
public async Task<string> MyUpdateAsync(UpdateInput updateInput) | ||
{ | ||
await Workflow.WaitConditionAsync(() => ReadyForUpdateToExecute(updateInput)); | ||
// ... | ||
} | ||
[WorkflowUpdate] | ||
public async Task<string> MyUpdateAsync(UpdateInput updateInput) | ||
{ | ||
await Workflow.WaitConditionAsync(() => ReadyForUpdateToExecute(updateInput)); | ||
// ... | ||
} | ||
``` | ||
|
||
Remember: Handlers can execute before the main Workflow method starts. | ||
|
@@ -515,10 +513,10 @@ By default, your Worker will log a warning when you allow a Workflow Execution t | |
You can silence these warnings on a per-handler basis by passing the `UnfinishedPolicy` argument to the [`WorkflowSignalAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowSignalAttribute.html) / [`WorkflowUpdateAttribute`](https://dotnet.temporal.io/api/Temporalio.Workflows.WorkflowUpdateAttribute.html) decorator: | ||
|
||
```csharp | ||
[WorkflowUpdate(UnfinishedPolicy = HandlerUnfinishedPolicy.Abandon)] | ||
public async Task MyUpdateAsync() | ||
{ | ||
// ... | ||
[WorkflowUpdate(UnfinishedPolicy = HandlerUnfinishedPolicy.Abandon)] | ||
public async Task MyUpdateAsync() | ||
{ | ||
// ... | ||
``` | ||
|
||
See [Finishing handlers before the Workflow completes](/encyclopedia/workflow-message-passing#finishing-message-handlers) for more information. | ||
|
@@ -595,7 +593,7 @@ When sending a Signal, Update, or Query to a Workflow, your Client might encount | |
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) exception whose `Code` property is [`RpcException.StatusCode`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.StatusCode.html) with a status of `Unavailable` (after some retries). | ||
|
||
- **The Workflow does not exist**: | ||
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) exception whose `Code` property is [`RpcException.StatusCode`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.StatusCode.html) with a status of `NotFound`. | ||
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) exception whose `Code` property is [`RpcException.StatusCode`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.StatusCode.html) with a status of `NotFound`. | ||
|
||
See [Exceptions in message handlers](/encyclopedia/workflow-message-passing#exceptions) for a non–.NET-specific discussion of this topic. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could probably be rephrased. "non–.NET-specific" |
||
|
||
|
@@ -614,18 +612,18 @@ When working with Updates, you may encounter these errors: | |
- **No Workflow Workers are polling the Task Queue**: | ||
Your request will be retried by the SDK Client indefinitely. | ||
Use a `CancellationToken` in your [RPC options](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowUpdateOptions.html#Temporalio_Client_WorkflowUpdateOptions_Rpc) to cancel the Update. | ||
This raises a [Temporalio.Exceptions.WorkflowUpdateRpcTimeoutOrCanceledException](https://dotnet.temporal.io/api/Temporalio.Exceptions.WorkflowUpdateRpcTimeoutOrCanceledException.html) exception . | ||
This raises a [Temporalio.Exceptions.WorkflowUpdateRpcTimeoutOrCanceledException](https://dotnet.temporal.io/api/Temporalio.Exceptions.WorkflowUpdateRpcTimeoutOrCanceledException.html) exception . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an extra space here. |
||
|
||
- **Update failed**: You'll receive a [`Temporalio.Exceptions.WorkflowUpdateFailedException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.WorkflowUpdateFailedException.html) exception. | ||
There are two ways this can happen: | ||
|
||
- The Update was rejected by an Update validator defined in the Workflow alongside the Update handler. | ||
- The Update was rejected by an Update validator defined in the Workflow alongside the Update handler. | ||
|
||
- The Update failed after having been accepted. | ||
- The Update failed after having been accepted. | ||
|
||
Update failures are like [Workflow failures](/references/failures). | ||
Issues that cause a Workflow failure in the main method also cause Update failures in the Update handler. | ||
These might include: | ||
Update failures are like [Workflow failures](/references/failures). | ||
Issues that cause a Workflow failure in the main method also cause Update failures in the Update handler. | ||
These might include: | ||
|
||
- A failed Child Workflow | ||
- A failed Activity (if the Activity retries have been set to a finite number) | ||
|
@@ -634,25 +632,25 @@ When working with Updates, you may encounter these errors: | |
|
||
- **The handler caused the Workflow Task to fail**: | ||
A [Workflow Task Failure](/references/failures) causes the server to retry Workflow Tasks indefinitely. What happens to your Update request depends on its stage: | ||
- If the request hasn't been accepted by the server, you receive a `FAILED_PRECONDITION` [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) exception. | ||
- If the request has been accepted, it is durable. | ||
Once the Workflow is healthy again after a code deploy, use an [`UpdateHandle`](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowUpdateHandle.html) to fetch the Update result. | ||
- If the request hasn't been accepted by the server, you receive a `FAILED_PRECONDITION` [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) exception. | ||
- If the request has been accepted, it is durable. | ||
Once the Workflow is healthy again after a code deploy, use an [`UpdateHandle`](https://dotnet.temporal.io/api/Temporalio.Client.WorkflowUpdateHandle.html) to fetch the Update result. | ||
|
||
- **The Workflow finished while the Update handler execution was in progress**: | ||
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) "workflow execution already completed". | ||
|
||
This will happen if the Workflow finished while the Update handler execution was in progress, for example because | ||
This will happen if the Workflow finished while the Update handler execution was in progress, for example because | ||
|
||
- The Workflow was canceled or failed. | ||
- The Workflow was canceled or failed. | ||
|
||
- The Workflow completed normally or continued-as-new and the Workflow author did not [wait for handlers to be finished](/encyclopedia/workflow-message-passing#finishing-message-handlers). | ||
- The Workflow completed normally or continued-as-new and the Workflow author did not [wait for handlers to be finished](/encyclopedia/workflow-message-passing#finishing-message-handlers). | ||
|
||
### Problems when sending a Query {#query-problems} | ||
|
||
When working with Queries, you may encounter these errors: | ||
|
||
- **There is no Workflow Worker polling the Task Queue**: | ||
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) on which the `Code` is a [`RpcException.StatusCode`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.StatusCode.html) with a status of `FailedPrecondition`. | ||
You'll receive a [`Temporalio.Exceptions.RpcException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.html) on which the `Code` is a [`RpcException.StatusCode`](https://dotnet.temporal.io/api/Temporalio.Exceptions.RpcException.StatusCode.html) with a status of `FailedPrecondition`. | ||
|
||
- **Query failed**: | ||
You'll receive a [`Temporalio.Exceptions.WorkflowQueryFailedException`](https://dotnet.temporal.io/api/Temporalio.Exceptions.WorkflowQueryFailedException.html) exception if something goes wrong during a Query. | ||
|
@@ -662,7 +660,6 @@ When working with Queries, you may encounter these errors: | |
- **The handler caused the Workflow Task to fail.** | ||
This would happen, for example, if the Query handler blocks the thread for too long without yielding. | ||
|
||
|
||
## Dynamic Handler {#dynamic-handler} | ||
|
||
Temporal supports Dynamic Queries, Signals, Updates, Workflows, and Activities. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like this needs a link.