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

maintenance: yarn format on repo #3116

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
2 changes: 1 addition & 1 deletion docs/cli/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tags:

:::tip Support, stability, and dependency info

Temporal CLI 1.1 is now available.
Temporal CLI 1.1 is now available.
See the [release notes](https://github.com/temporalio/cli/releases/tag/v1.1.0) or view the latest command information from the utility:

```
Expand Down
91 changes: 44 additions & 47 deletions docs/develop/dotnet/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.
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 looks like this needs a link.


:::info NON-TYPE SAFE API CALLS

Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could probably be rephrased. "non–.NET-specific"


Expand All @@ -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 .
Copy link
Contributor Author

@jsundai jsundai Oct 2, 2024

Choose a reason for hiding this comment

The 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)
Expand All @@ -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.
Expand All @@ -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.
Expand Down
Loading