Skip to content

Commit af3a9f2

Browse files
authored
Merge branch 'v1.16' into fix-net-command
2 parents 02378bb + a6527c4 commit af3a9f2

File tree

11 files changed

+214
-169
lines changed

11 files changed

+214
-169
lines changed

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-architecture.md

Lines changed: 99 additions & 51 deletions
Large diffs are not rendered by default.

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-features-concepts.md

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ weight: 2000
66
description: "Learn more about the Dapr Workflow features and concepts"
77
---
88

9-
Now that you've learned about the [workflow building block]({{% ref workflow-overview.md %}}) at a high level, let's deep dive into the features and concepts included with the Dapr Workflow engine and SDKs. Dapr Workflow exposes several core features and concepts which are common across all supported languages.
9+
Now that you've learned about the [workflow building block]({{% ref workflow-overview.md %}}) at a high level, let's deep dive into the features and concepts included with the Dapr Workflow engine and SDKs. Dapr Workflow exposes several core features and concepts which are common across all supported languages.
1010

1111
{{% alert title="Note" color="primary" %}}
1212
For more information on how workflow state is managed, see the [workflow architecture guide]({{% ref workflow-architecture.md %}}).
1313
{{% /alert %}}
1414

1515
## Workflows
1616

17-
Dapr Workflows are functions you write that define a series of tasks to be executed in a particular order. The Dapr Workflow engine takes care of scheduling and execution of the tasks, including managing failures and retries. If the app hosting your workflows is scaled out across multiple machines, the workflow engine may also load balance the execution of workflows and their tasks across multiple machines.
17+
Dapr Workflows are functions you write that define a series of tasks to be executed in a particular order.
18+
The Dapr Workflow engine takes care of scheduling and execution of the tasks, including managing failures and retries.
19+
If the app hosting your workflows is scaled out across multiple machines, the workflow engine load balances the execution of workflows and their tasks across multiple machines.
1820

1921
There are several different kinds of tasks that a workflow can schedule, including
2022
- [Activities]({{% ref "workflow-features-concepts.md#workflow-activities" %}}) for executing custom logic
@@ -32,7 +34,7 @@ Only one workflow instance with a given ID can exist at any given time. However,
3234

3335
Dapr Workflows maintain their execution state by using a technique known as [event sourcing](https://learn.microsoft.com/azure/architecture/patterns/event-sourcing). Instead of storing the current state of a workflow as a snapshot, the workflow engine manages an append-only log of history events that describe the various steps that a workflow has taken. When using the workflow SDK, these history events are stored automatically whenever the workflow "awaits" for the result of a scheduled task.
3436

35-
When a workflow "awaits" a scheduled task, it unloads itself from memory until the task completes. Once the task completes, the workflow engine schedules the workflow function to run again. This second workflow function execution is known as a _replay_.
37+
When a workflow "awaits" a scheduled task, it unloads itself from memory until the task completes. Once the task completes, the workflow engine schedules the workflow function to run again. This second workflow function execution is known as a _replay_.
3638

3739
When a workflow function is replayed, it runs again from the beginning. However, when it encounters a task that already completed, instead of scheduling that task again, the workflow engine:
3840

@@ -57,16 +59,16 @@ As discussed in the [workflow replay]({{% ref "#workflow-replay" %}}) section, w
5759

5860
You can use the following two techniques to write workflows that may need to schedule extreme numbers of tasks:
5961

60-
1. **Use the _continue-as-new_ API**:
62+
1. **Use the _continue-as-new_ API**:
6163
Each workflow SDK exposes a _continue-as-new_ API that workflows can invoke to restart themselves with a new input and history. The _continue-as-new_ API is especially ideal for implementing "eternal workflows", like monitoring agents, which would otherwise be implemented using a `while (true)`-like construct. Using _continue-as-new_ is a great way to keep the workflow history size small.
62-
64+
6365
> The _continue-as-new_ API truncates the existing history, replacing it with a new history.
6466
65-
1. **Use child workflows**:
67+
1. **Use child workflows**:
6668
Each workflow SDK exposes an API for creating child workflows. A child workflow behaves like any other workflow, except that it's scheduled by a parent workflow. Child workflows have:
67-
- Their own history
68-
- The benefit of distributing workflow function execution across multiple machines.
69-
69+
- Their own history
70+
- The benefit of distributing workflow function execution across multiple machines.
71+
7072
If a workflow needs to schedule thousands of tasks or more, it's recommended that those tasks be distributed across child workflows so that no single workflow's history size grows too large.
7173

7274
### Updating workflow code
@@ -145,18 +147,6 @@ Workflows can also wait for multiple external event signals of the same name, in
145147

146148
Learn more about [external system interaction.]({{% ref "workflow-patterns.md#external-system-interaction" %}})
147149

148-
## Workflow backend
149-
150-
Dapr Workflow relies on the Durable Task Framework for Go (a.k.a. [durabletask-go](https://github.com/dapr/durabletask-go)) as the core engine for executing workflows. This engine is designed to support multiple backend implementations. For example, the [durabletask-go](https://github.com/dapr/durabletask-go) repo includes a SQLite implementation and the Dapr repo includes an Actors implementation.
151-
152-
By default, Dapr Workflow supports the Actors backend, which is stable and scalable. However, you can choose a different backend supported in Dapr Workflow. For example, [SQLite](https://github.com/dapr/durabletask-go/tree/main/backend/sqlite)(TBD future release) could be an option for backend for local development and testing.
153-
154-
The backend implementation is largely decoupled from the workflow core engine or the programming model that you see. The backend primarily impacts:
155-
- How workflow state is stored
156-
- How workflow execution is coordinated across replicas
157-
158-
In that sense, it's similar to Dapr's state store abstraction, except designed specifically for workflow. All APIs and programming model features are the same, regardless of which backend is used.
159-
160150
## Purging
161151

162152
Workflow state can be purged from a state store, purging all its history and removing all metadata related to a specific workflow instance. The purge capability is used for workflows that have run to a `COMPLETED`, `FAILED`, or `TERMINATED` state.
@@ -165,11 +155,11 @@ Learn more in [the workflow API reference guide]({{% ref workflow_api.md %}}).
165155

166156
## Limitations
167157

168-
### Workflow determinism and code restraints
158+
### Workflow determinism and code restraints
169159

170160
To take advantage of the workflow replay technique, your workflow code needs to be deterministic. For your workflow code to be deterministic, you may need to work around some limitations.
171161

172-
#### Workflow functions must call deterministic APIs.
162+
#### Workflow functions must call deterministic APIs.
173163
APIs that generate random numbers, random UUIDs, or the current date are _non-deterministic_. To work around this limitation, you can:
174164
- Use these APIs in activity functions, or
175165
- (Preferred) Use built-in equivalent APIs offered by the SDK. For example, each authoring SDK provides an API for retrieving the current time in a deterministic manner.
@@ -269,9 +259,9 @@ const currentTime = ctx.CurrentUTCDateTime()
269259
{{< /tabpane >}}
270260

271261

272-
#### Workflow functions must only interact _indirectly_ with external state.
273-
External data includes any data that isn't stored in the workflow state. Workflows must not interact with global variables, environment variables, the file system, or make network calls.
274-
262+
#### Workflow functions must only interact _indirectly_ with external state.
263+
External data includes any data that isn't stored in the workflow state. Workflows must not interact with global variables, environment variables, the file system, or make network calls.
264+
275265
Instead, workflows should interact with external state _indirectly_ using workflow inputs, activity tasks, and through external event handling.
276266

277267
For example, instead of this:
@@ -377,11 +367,11 @@ err := ctx.CallActivity(MakeHttpCallActivity, workflow.ActivityInput("https://ex
377367
{{< /tabpane >}}
378368

379369

380-
#### Workflow functions must execute only on the workflow dispatch thread.
370+
#### Workflow functions must execute only on the workflow dispatch thread.
381371
The implementation of each language SDK requires that all workflow function operations operate on the same thread (goroutine, etc.) that the function was scheduled on. Workflow functions must never:
382372
- Schedule background threads, or
383-
- Use APIs that schedule a callback function to run on another thread.
384-
373+
- Use APIs that schedule a callback function to run on another thread.
374+
385375
Failure to follow this rule could result in undefined behavior. Any background processing should instead be delegated to activity tasks, which can be scheduled to run serially or concurrently.
386376

387377
For example, instead of this:
@@ -478,19 +468,18 @@ task.Await(nil)
478468

479469
Make sure updates you make to the workflow code maintain its determinism. A couple examples of code updates that can break workflow determinism:
480470

481-
- **Changing workflow function signatures**:
482-
Changing the name, input, or output of a workflow or activity function is considered a breaking change and must be avoided.
471+
- **Changing workflow function signatures**:
472+
Changing the name, input, or output of a workflow or activity function is considered a breaking change and must be avoided.
483473

484-
- **Changing the number or order of workflow tasks**:
474+
- **Changing the number or order of workflow tasks**:
485475
Changing the number or order of workflow tasks causes a workflow instance's history to no longer match the code and may result in runtime errors or other unexpected behavior.
486476

487477
To work around these constraints:
488478

489-
- Instead of updating existing workflow code, leave the existing workflow code as-is and create new workflow definitions that include the updates.
490-
- Upstream code that creates workflows should only be updated to create instances of the new workflows.
479+
- Instead of updating existing workflow code, leave the existing workflow code as-is and create new workflow definitions that include the updates.
480+
- Upstream code that creates workflows should only be updated to create instances of the new workflows.
491481
- Leave the old code around to ensure that existing workflow instances can continue to run without interruption. If and when it's known that all instances of the old workflow logic have completed, then the old workflow code can be safely deleted.
492482

493-
494483
## Next steps
495484

496485
{{< button text="Workflow patterns >>" page="workflow-patterns.md" >}}

daprdocs/content/en/developing-applications/building-blocks/workflow/workflow-overview.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ weight: 1000
66
description: "Overview of Dapr Workflow"
77
---
88

9-
Dapr workflow makes it easy for developers to write business logic and integrations in a reliable way. Since Dapr workflows are stateful, they support long-running and fault-tolerant applications, ideal for orchestrating microservices. Dapr workflow works seamlessly with other Dapr building blocks, such as service invocation, pub/sub, state management, and bindings.
9+
Dapr workflow makes it easy for developers to write business logic and integrations in a reliable way.
10+
Since Dapr workflows are stateful, they support long-running and fault-tolerant applications, ideal for orchestrating microservices.
11+
Dapr workflow works seamlessly with other Dapr building blocks, such as service invocation, pub/sub, state management, and bindings.
1012

1113
The durable, resilient Dapr Workflow capability:
1214

1315
- Offers a built-in workflow runtime for driving Dapr Workflow execution.
1416
- Provides SDKs for authoring workflows in code, using any language.
1517
- Provides HTTP and gRPC APIs for managing workflows (start, query, pause/resume, raise event, terminate, purge).
16-
- Integrates with any other workflow runtime via workflow components.
1718

1819
<img src="/images/workflow-overview/workflow-overview.png" width=800 alt="Diagram showing basics of Dapr Workflow">
1920

@@ -28,16 +29,20 @@ Some example scenarios that Dapr Workflow can perform are:
2829

2930
### Workflows and activities
3031

31-
With Dapr Workflow, you can write activities and then orchestrate those activities in a workflow. Workflow activities are:
32+
With Dapr Workflow, you can write activities and then orchestrate those activities in a workflow.
33+
Workflow activities are:
3234

3335
- The basic unit of work in a workflow
3436
- Used for calling other (Dapr) services, interacting with state stores, and pub/sub brokers.
37+
- Used for calling external third party services.
3538

3639
[Learn more about workflow activities.]({{% ref "workflow-features-concepts.md##workflow-activities" %}})
3740

3841
### Child workflows
3942

40-
In addition to activities, you can write workflows to schedule other workflows as child workflows. A child workflow has its own instance ID, history, and status that is independent of the parent workflow that started it, except for the fact that terminating the parent workflow terminates all of the child workflows created by it. Child workflow also supports automatic retry policies.
43+
In addition to activities, you can write workflows to schedule other workflows as child workflows.
44+
A child workflow has its own instance ID, history, and status that is independent of the parent workflow that started it, except for the fact that terminating the parent workflow terminates all of the child workflows created by it.
45+
Child workflow also supports automatic retry policies.
4146

4247
[Learn more about child workflows.]({{% ref "workflow-features-concepts.md#child-workflows" %}})
4348

@@ -49,7 +54,8 @@ Same as Dapr actors, you can schedule reminder-like durable delays for any time
4954

5055
### Workflow HTTP calls to manage a workflow
5156

52-
When you create an application with workflow code and run it with Dapr, you can call specific workflows that reside in the application. Each individual workflow can be:
57+
When you create an application with workflow code and run it with Dapr, you can call specific workflows that reside in the application.
58+
Each individual workflow can be:
5359

5460
- Started or terminated through a POST request
5561
- Triggered to deliver a named event through a POST request
@@ -61,13 +67,15 @@ When you create an application with workflow code and run it with Dapr, you can
6167

6268
## Workflow patterns
6369

64-
Dapr Workflow simplifies complex, stateful coordination requirements in microservice architectures. The following sections describe several application patterns that can benefit from Dapr Workflow.
70+
Dapr Workflow simplifies complex, stateful coordination requirements in microservice architectures.
71+
The following sections describe several application patterns that can benefit from Dapr Workflow.
6572

6673
Learn more about [different types of workflow patterns]({{% ref workflow-patterns.md %}})
6774

6875
## Workflow SDKs
6976

70-
The Dapr Workflow _authoring SDKs_ are language-specific SDKs that contain types and functions to implement workflow logic. The workflow logic lives in your application and is orchestrated by the Dapr Workflow engine running in the Dapr sidecar via a gRPC stream.
77+
The Dapr Workflow _authoring SDKs_ are language-specific SDKs that contain types and functions to implement workflow logic.
78+
The workflow logic lives in your application and is orchestrated by the Dapr Workflow engine running in the Dapr sidecar via a gRPC stream.
7179

7280
### Supported SDKs
7381

daprdocs/content/en/reference/components-reference/supported-bindings/blobstorage.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ To perform a create blob operation, invoke the Azure Blob Storage binding with a
8686
##### Save text to a random generated UUID blob
8787

8888
{{< tabpane text=true >}}
89-
{{% tab %}}
89+
{{% tab "Windows" %}}
9090
On Windows, utilize cmd prompt (PowerShell has different escaping mechanism)
9191
```bash
9292
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\" }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
9393
```
9494
{{% /tab %}}
9595

96-
{{% tab %}}
96+
{{% tab "Linux" %}}
9797
```bash
9898
curl -d '{ "operation": "create", "data": "Hello World" }' \
9999
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -106,14 +106,14 @@ To perform a create blob operation, invoke the Azure Blob Storage binding with a
106106

107107
{{< tabpane text=true >}}
108108

109-
{{% tab %}}
109+
{{% tab "Windows" %}}
110110
```bash
111111
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"blobName\": \"my-test-file.txt\" } }" \
112112
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
113113
```
114114
{{% /tab %}}
115115

116-
{{% tab %}}
116+
{{% tab "Linux" %}}
117117
```bash
118118
curl -d '{ "operation": "create", "data": "Hello World", "metadata": { "blobName": "my-test-file.txt" } }' \
119119
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -150,13 +150,13 @@ Then you can upload it as you would normally:
150150
151151
{{< tabpane text=true >}}
152152
153-
{{% tab %}}
153+
{{% tab "Windows" %}}
154154
```bash
155155
curl -d "{ \"operation\": \"create\", \"data\": \"YOUR_BASE_64_CONTENT\", \"metadata\": { \"blobName\": \"my-test-file.jpg\" } }" http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
156156
```
157157
{{% /tab %}}
158158
159-
{{% tab %}}
159+
{{% tab "Linux" %}}
160160
```bash
161161
curl -d '{ "operation": "create", "data": "YOUR_BASE_64_CONTENT", "metadata": { "blobName": "my-test-file.jpg" } }' \
162162
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -199,13 +199,13 @@ The metadata parameters are:
199199

200200
{{< tabpane text=true >}}
201201

202-
{{% tab %}}
202+
{{% tab "Windows" %}}
203203
```bash
204204
curl -d '{ \"operation\": \"get\", \"metadata\": { \"blobName\": \"myblob\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
205205
```
206206
{{% /tab %}}
207207

208-
{{% tab %}}
208+
{{% tab "Linux" %}}
209209
```bash
210210
curl -d '{ "operation": "get", "metadata": { "blobName": "myblob" }}' \
211211
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -247,13 +247,13 @@ The metadata parameters are:
247247

248248
{{< tabpane text=true >}}
249249

250-
{{% tab %}}
250+
{{% tab "Windows" %}}
251251
```bash
252252
curl -d '{ \"operation\": \"delete\", \"metadata\": { \"blobName\": \"myblob\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
253253
```
254254
{{% /tab %}}
255255

256-
{{% tab %}}
256+
{{% tab "Linux" %}}
257257
```bash
258258
curl -d '{ "operation": "delete", "metadata": { "blobName": "myblob" }}' \
259259
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -266,13 +266,13 @@ The metadata parameters are:
266266

267267
{{< tabpane text=true >}}
268268

269-
{{% tab %}}
269+
{{% tab "Windows" %}}
270270
```bash
271271
curl -d '{ \"operation\": \"delete\", \"metadata\": { \"blobName\": \"myblob\", \"deleteSnapshots\": \"only\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
272272
```
273273
{{% /tab %}}
274274

275-
{{% tab %}}
275+
{{% tab "Linux" %}}
276276
```bash
277277
curl -d '{ "operation": "delete", "metadata": { "blobName": "myblob", "deleteSnapshots": "only" }}' \
278278
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
@@ -285,13 +285,13 @@ The metadata parameters are:
285285

286286
{{< tabpane text=true >}}
287287

288-
{{% tab %}}
288+
{{% tab "Windows" %}}
289289
```bash
290290
curl -d '{ \"operation\": \"delete\", \"metadata\": { \"blobName\": \"myblob\", \"deleteSnapshots\": \"include\" }}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
291291
```
292292
{{% /tab %}}
293293

294-
{{% tab %}}
294+
{{% tab "Linux" %}}
295295
```bash
296296
curl -d '{ "operation": "delete", "metadata": { "blobName": "myblob", "deleteSnapshots": "include" }}' \
297297
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>

0 commit comments

Comments
 (0)