mirror of https://github.com/dapr/docs.git
Merge branch 'v1.11' into v1.10
This commit is contained in:
commit
fa8bba0b13
|
@ -3,11 +3,11 @@ name: Azure Static Web App v1.9
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- v1.10
|
||||
- v1.11
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- v1.10
|
||||
- v1.11
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
|
@ -18,7 +18,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0
|
||||
- name: Setup Docsy
|
||||
run: cd daprdocs && git submodule update --init --recursive && sudo npm install -D --save autoprefixer && sudo npm install -D --save postcss-cli
|
||||
- name: Build And Deploy
|
||||
|
@ -28,7 +28,7 @@ jobs:
|
|||
HUGO_ENV: production
|
||||
HUGO_VERSION: "0.100.2"
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_10 }}
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_11 }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
|
||||
skip_deploy_on_missing_secrets: true
|
||||
action: "upload"
|
||||
|
@ -37,7 +37,7 @@ jobs:
|
|||
app_location: "/daprdocs" # App source code path
|
||||
api_location: "api" # Api source code path - optional
|
||||
output_location: "public" # Built app content directory - optional
|
||||
app_build_command: "hugo"
|
||||
app_build_command: "git config --global --add safe.directory /github/workspace && hugo"
|
||||
###### End of Repository/Build Configurations ######
|
||||
|
||||
close_pull_request_job:
|
||||
|
@ -49,6 +49,6 @@ jobs:
|
|||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v0.0.1-preview
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_10 }}
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_11 }}
|
||||
skip_deploy_on_missing_secrets: true
|
||||
action: "close"
|
|
@ -26,3 +26,6 @@
|
|||
[submodule "sdkdocs/pluggable-components/dotnet"]
|
||||
path = sdkdocs/pluggable-components/dotnet
|
||||
url = https://github.com/dapr-sandbox/components-dotnet-sdk
|
||||
[submodule "sdkdocs/pluggable-components/go"]
|
||||
path = sdkdocs/pluggable-components/go
|
||||
url = https://github.com/dapr-sandbox/components-go-sdk
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Site Configuration
|
||||
baseURL = "https://docs.dapr.io"
|
||||
baseURL = "https://v1-11.docs.dapr.io"
|
||||
title = "Dapr Docs"
|
||||
theme = "docsy"
|
||||
disableFastRender = true
|
||||
|
@ -71,6 +71,10 @@ id = "G-60C6Q1ETC1"
|
|||
source = "../sdkdocs/pluggable-components/dotnet/daprdocs/content/en/dotnet-sdk-docs"
|
||||
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-dotnet"
|
||||
lang = "en"
|
||||
[[module.mounts]]
|
||||
source = "../sdkdocs/pluggable-components/go/daprdocs/content/en/go-sdk-docs"
|
||||
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-go"
|
||||
lang = "en"
|
||||
[[module.mounts]]
|
||||
source = "../sdkdocs/dotnet/daprdocs/content/en/dotnet-sdk-contributing"
|
||||
target = "content/contributing/sdk-contrib/"
|
||||
|
@ -164,23 +168,20 @@ offlineSearch = false
|
|||
github_repo = "https://github.com/dapr/docs"
|
||||
github_project_repo = "https://github.com/dapr/dapr"
|
||||
github_subdir = "daprdocs"
|
||||
github_branch = "v1.10"
|
||||
github_branch = "v1.11"
|
||||
|
||||
# Versioning
|
||||
version_menu = "v1.10 (latest)"
|
||||
version = "v1.10"
|
||||
version_menu = "v1.11 (preview)"
|
||||
version = "v1.11"
|
||||
archived_version = false
|
||||
url_latest_version = "https://docs.dapr.io"
|
||||
|
||||
[[params.versions]]
|
||||
version = "v1.11 (preview)"
|
||||
url = "https://v1-11.docs.dapr.io"
|
||||
[[params.versions]]
|
||||
version = "v1.10 (latest)"
|
||||
url = "#"
|
||||
[[params.versions]]
|
||||
version = "v1.9"
|
||||
url = "https://v1-9.docs.dapr.io"
|
||||
version = "v1.10 (latest)"
|
||||
url = "https://docs.dapr.io"
|
||||
[[params.versions]]
|
||||
version = "v1.9"
|
||||
url = "https://v1-9.docs.dapr.io"
|
||||
|
|
|
@ -45,9 +45,11 @@ Manage your workflow using HTTP calls. The example below plugs in the properties
|
|||
To start your workflow with an ID `12345678`, run:
|
||||
|
||||
```bash
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/12345678/start
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=12345678
|
||||
```
|
||||
|
||||
Note that workflow instance IDs can only contain alphanumeric characters, underscores, and dashes.
|
||||
|
||||
### Terminate workflow
|
||||
|
||||
To terminate your workflow with an ID `12345678`, run:
|
||||
|
@ -61,7 +63,7 @@ POST http://localhost:3500/v1.0-alpha1/workflows/dapr/12345678/terminate
|
|||
To fetch workflow information (outputs and inputs) with an ID `12345678`, run:
|
||||
|
||||
```bash
|
||||
GET http://localhost:3500/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/12345678
|
||||
GET http://localhost:3500/v1.0-alpha1/workflows/dapr/12345678
|
||||
```
|
||||
|
||||
Learn more about these HTTP calls in the [workflow API reference guide]({{< ref workflow_api.md >}}).
|
||||
|
|
|
@ -52,8 +52,10 @@ Each workflow instance managed by the engine is represented as one or more spans
|
|||
|
||||
There are two types of actors that are internally registered within the Dapr sidecar in support of the workflow engine:
|
||||
|
||||
- `dapr.internal.wfengine.workflow`
|
||||
- `dapr.internal.wfengine.activity`
|
||||
- `dapr.internal.{namespace}.{appID}.workflow`
|
||||
- `dapr.internal.{namespace}.{appID}.activity`
|
||||
|
||||
The `{namespace}` value is the Dapr namespace and defaults to `default` if no namespace is configured. The `{appID}` value is the app's ID. For example, if you have a workflow app named "wfapp", then the type of the workflow actor would be `dapr.internal.default.wfapp.workflow` and the type of the activity actor would be `dapr.internal.default.wfapp.activity`.
|
||||
|
||||
The following diagram demonstrates how internal workflow actors operate in a Kubernetes scenario:
|
||||
|
||||
|
@ -61,11 +63,13 @@ The following diagram demonstrates how internal workflow actors operate in a Kub
|
|||
|
||||
Just like user-defined actors, internal workflow actors are distributed across the cluster by the actor placement service. They also maintain their own state and make use of reminders. However, unlike actors that live in application code, these _internal_ actors are embedded into the Dapr sidecar. Application code is completely unaware that these actors exist.
|
||||
|
||||
There are two types of actors registered by the Dapr sidecar for workflow: the _workflow_ actor and the _activity_ actor. The next sections will go into more details on each.
|
||||
{{% alert title="Note" color="primary" %}}
|
||||
The internal workflow actor types are only registered after an app has registered a workflow using a Dapr Workflow SDK. If an app never registers a workflow, then the internal workflow actors are never registered.
|
||||
{{% /alert %}}
|
||||
|
||||
### Workflow actors
|
||||
|
||||
A new instance of the `dapr.internal.wfengine.workflow` actor is activated for every workflow instance that gets created. The ID of the _workflow_ actor is the ID of the workflow. This internal actor stores the state of the workflow as it progresses and determines the node on which the workflow code executes via the actor placement service.
|
||||
Workflow actors are responsible for managing the state and placement of all workflows running in the app. A new instance of the workflow actor is activated for every workflow instance that gets created. The ID of the workflow actor is the ID of the workflow. This internal actor stores the state of the workflow as it progresses and determines the node on which the workflow code executes via the actor placement service.
|
||||
|
||||
Each workflow actor saves its state using the following keys in the configured state store:
|
||||
|
||||
|
@ -94,17 +98,13 @@ To summarize:
|
|||
|
||||
### Activity actors
|
||||
|
||||
A new instance of the `dapr.internal.wfengine.activity` actor is activated for every activity task that gets scheduled by a workflow. The ID of the _activity_ actor is the ID of the workflow combined with a sequence number (sequence numbers start with 0). For example, if a workflow has an ID of `876bf371` and is the third activity to be scheduled by the workflow, it's ID will be `876bf371#2` where `2` is the sequence number.
|
||||
Activity actors are responsible for managing the state and placement of all workflow activity invocations. A new instance of the activity actor is activated for every activity task that gets scheduled by a workflow. The ID of the activity actor is the ID of the workflow combined with a sequence number (sequence numbers start with 0). For example, if a workflow has an ID of `876bf371` and is the third activity to be scheduled by the workflow, it's ID will be `876bf371::2` where `2` is the sequence number.
|
||||
|
||||
Each activity actor stores a single key into the state store:
|
||||
|
||||
| Key | Description |
|
||||
| --- | ----------- |
|
||||
| `activityreq-N` | The key contains the activity invocation payload, which includes the serialized activity input data. The `N` value is a 64-bit unsigned integer that represents the _generation_ of the workflow, a concept which is outside the scope of this documentation. |
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
In the [Alpha release of the Dapr Workflow engine]({{< ref support-preview-features.md >}}), activity actor state will remain in the state store even after the activity task has completed. Scheduling a large number of workflow activities could result in unbounded storage usage. In a future release, data retention policies will be introduced that can automatically purge the state store of completed activity state.
|
||||
{{% /alert %}}
|
||||
| `activityState` | The key contains the activity invocation payload, which includes the serialized activity input data. This key is deleted automatically after the activity invocation has completed. |
|
||||
|
||||
The following diagram illustrates the typical lifecycle of an activity actor.
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ In the fan-out/fan-in design pattern, you execute multiple tasks simultaneously
|
|||
|
||||
<img src="/images/workflow-overview/workflows-fanin-fanout.png" width=800 alt="Diagram showing how the fan-out/fan-in workflow pattern works">
|
||||
|
||||
In addition to the challenges mentioned in [the previous pattern]({{< ref "workflow-overview.md#task-chaining" >}}), there are several important questions to consider when implementing the fan-out/fan-in pattern manually:
|
||||
In addition to the challenges mentioned in [the previous pattern]({{< ref "workflow-patterns.md#task-chaining" >}}), there are several important questions to consider when implementing the fan-out/fan-in pattern manually:
|
||||
|
||||
- How do you control the degree of parallelism?
|
||||
- How do you know when to trigger subsequent aggregation steps?
|
||||
|
|
|
@ -14,4 +14,5 @@ The Dapr SDKs are the easiest way for you to create pluggable components. Choose
|
|||
|
||||
| Language | Status |
|
||||
|----------|:------:|
|
||||
| [Go]({{< ref pluggable-components-go >}}) | In development |
|
||||
| [.NET]({{< ref pluggable-components-dotnet >}}) | In development |
|
||||
|
|
|
@ -28,19 +28,19 @@ Refer to the [`action.yml` metadata file](https://github.com/dapr/setup-dapr/blo
|
|||
version: '{{% dapr-latest-version long="true" %}}'
|
||||
|
||||
- name: Initialize Dapr
|
||||
shell: pwsh
|
||||
shell: bash
|
||||
run: |
|
||||
# Get the credentials to K8s to use with dapr init
|
||||
az aks get-credentials --resource-group ${{ env.RG_NAME }} --name "${{ steps.azure-deployment.outputs.aksName }}"
|
||||
|
||||
|
||||
# Initialize Dapr
|
||||
# Group the Dapr init logs so these lines can be collapsed.
|
||||
Write-Output "::group::Initialize Dapr"
|
||||
echo "::group::Initialize Dapr"
|
||||
dapr init --kubernetes --wait --runtime-version ${{ env.DAPR_VERSION }}
|
||||
Write-Output "::endgroup::"
|
||||
echo "::endgroup::"
|
||||
|
||||
dapr status --kubernetes
|
||||
working-directory: ./twitter-sentiment-processor/demos/demo3
|
||||
working-directory: ./demos/demo3
|
||||
```
|
||||
|
||||
## Next steps
|
||||
|
|
|
@ -236,6 +236,12 @@ The injector watchdog is disabled by default when running Dapr in Kubernetes mod
|
|||
|
||||
Refer to the documentation for the [Dapr operator]({{< ref operator >}}) service for more details on the injector watchdog and how to enable it.
|
||||
|
||||
## Configuring seccompProfile for sidecar containers
|
||||
|
||||
By default, the Dapr sidecar Injector injects a sidecar without any `seccompProfile`. However, to have Dapr sidecar container run successfully in a namespace with [Restricted](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted) profile, the sidecar container needs to have `securityContext.seccompProfile.Type` to not be `nil`.
|
||||
|
||||
Refer to [this]({{< ref "arguments-annotations-overview.md" >}}) documentation to set appropriate `seccompProfile` on sidecar container according to which profile it is running with.
|
||||
|
||||
## Best Practices
|
||||
|
||||
Watch this video for a deep dive into the best practices for running Dapr in production with Kubernetes
|
||||
|
|
|
@ -11,7 +11,7 @@ This article provides guidance on running Dapr with Podman on a Windows/Linux/ma
|
|||
## Prerequisites
|
||||
|
||||
- [Dapr CLI]({{< ref install-dapr-cli.md >}})
|
||||
- [Podman](https://podman.io/getting-started/installation.html)
|
||||
- [Podman](https://podman.io/docs/tutorials/installation)
|
||||
|
||||
## Initialize Dapr environment
|
||||
|
||||
|
|
|
@ -10,29 +10,25 @@ Dapr provides users with the ability to interact with workflows and comes with a
|
|||
|
||||
## Start workflow request
|
||||
|
||||
Start a workflow instance with the given name and instance ID.
|
||||
Start a workflow instance with the given name and optionally, an instance ID.
|
||||
|
||||
```bash
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflowName>/<instanceId>/start
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflowName>/start[?instanceId=<instanceId>]
|
||||
```
|
||||
|
||||
Note that workflow instance IDs can only contain alphanumeric characters, underscores, and dashes.
|
||||
|
||||
### URL parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
`workflowComponentName` | Current default is `dapr` for Dapr Workflows
|
||||
`workflowName` | Identify the workflow type
|
||||
`instanceId` | Unique value created for each run of a specific workflow
|
||||
`instanceId` | (Optional) Unique value created for each run of a specific workflow
|
||||
|
||||
### Request content
|
||||
|
||||
In the request you can pass along relevant input information that will be passed to the workflow:
|
||||
|
||||
```json
|
||||
{
|
||||
"input": // argument(s) to pass to the workflow which can be any valid JSON data type (such as objects, strings, numbers, arrays, etc.)
|
||||
}
|
||||
```
|
||||
Any request content will be passed to the workflow as input. The Dapr API passes the content as-is without attempting to interpret it.
|
||||
|
||||
### HTTP response codes
|
||||
|
||||
|
@ -48,9 +44,7 @@ The API call will provide a response similar to this:
|
|||
|
||||
```json
|
||||
{
|
||||
"WFInfo": {
|
||||
"instance_id": "SampleWorkflow"
|
||||
}
|
||||
"instanceID": "12345678"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -59,7 +53,7 @@ The API call will provide a response similar to this:
|
|||
Terminate a running workflow instance with the given name and instance ID.
|
||||
|
||||
```bash
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<instanceId>/terminate
|
||||
POST http://localhost:3500/v1.0-alpha1/workflows/<instanceId>/terminate
|
||||
```
|
||||
|
||||
### URL parameters
|
||||
|
@ -67,7 +61,6 @@ POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<instan
|
|||
Parameter | Description
|
||||
--------- | -----------
|
||||
`workflowComponentName` | Current default is `dapr` for Dapr Workflows
|
||||
`workflowName` | Identify the workflow type
|
||||
`instanceId` | Unique value created for each run of a specific workflow
|
||||
|
||||
### HTTP response codes
|
||||
|
@ -80,22 +73,14 @@ Code | Description
|
|||
|
||||
### Response content
|
||||
|
||||
The API call will provide a response similar to this:
|
||||
|
||||
```bash
|
||||
HTTP/1.1 202 Accepted
|
||||
Server: fasthttp
|
||||
Date: Thu, 12 Jan 2023 21:31:16 GMT
|
||||
Traceparent: 00-e3dedffedbeb9efbde9fbed3f8e2d8-5f38960d43d24e98-01
|
||||
Connection: close
|
||||
```
|
||||
This API does not return any content.
|
||||
|
||||
### Get workflow request
|
||||
|
||||
Get information about a given workflow instance.
|
||||
|
||||
```bash
|
||||
GET http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflowName>/<instanceId>
|
||||
GET http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<instanceId>
|
||||
```
|
||||
|
||||
### URL parameters
|
||||
|
@ -103,39 +88,30 @@ GET http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflo
|
|||
Parameter | Description
|
||||
--------- | -----------
|
||||
`workflowComponentName` | Current default is `dapr` for Dapr Workflows
|
||||
`workflowName` | Identify the workflow type
|
||||
`instanceId` | Unique value created for each run of a specific workflow
|
||||
|
||||
### HTTP response codes
|
||||
|
||||
Code | Description
|
||||
---- | -----------
|
||||
`202` | Accepted
|
||||
`200` | OK
|
||||
`400` | Request was malformed
|
||||
`500` | Request formatted correctly, error in dapr code or underlying component
|
||||
|
||||
### Response content
|
||||
|
||||
The API call will provide a response similar to this:
|
||||
|
||||
```bash
|
||||
HTTP/1.1 202 Accepted
|
||||
Server: fasthttp
|
||||
Date: Thu, 12 Jan 2023 21:31:16 GMT
|
||||
Content-Type: application/json
|
||||
Content-Length: 139
|
||||
Traceparent: 00-e3dedffedbeb9efbde9fbed3f8e2d8-5f38960d43d24e98-01
|
||||
Connection: close
|
||||
The API call will provide a JSON response similar to this:
|
||||
|
||||
```json
|
||||
{
|
||||
"WFInfo": {
|
||||
"instance_id": "SampleWorkflow"
|
||||
},
|
||||
"start_time": "2023-01-12T21:31:13Z",
|
||||
"metadata": {
|
||||
"status": "Running",
|
||||
"task_queue": "WorkflowSampleQueue"
|
||||
}
|
||||
"createdAt": "2023-01-12T21:31:13Z",
|
||||
"instanceID": "12345678",
|
||||
"lastUpdatedAt": "2023-01-12T21:31:13Z",
|
||||
"properties": {
|
||||
"property1": "value1",
|
||||
"property2": "value2",
|
||||
},
|
||||
"runtimeStatus": "RUNNING",
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -66,3 +66,4 @@ This table is meant to help users understand the equivalent options for running
|
|||
| not supported | not supported | | `dapr.io/volume-mounts` | List of pod volumes to be mounted to the sidecar container in read-only mode. Strings consisting of `volume:path` pairs separated by a comma. Example, `"volume-1:/tmp/mount1,volume-2:/home/root/mount2"`. |
|
||||
| not supported | not supported | | `dapr.io/volume-mounts-rw` | List of pod volumes to be mounted to the sidecar container in read-write mode. Strings consisting of `volume:path` pairs separated by a comma. Example, `"volume-1:/tmp/mount1,volume-2:/home/root/mount2"`. |
|
||||
| `--disable-builtin-k8s-secret-store` | not supported | | `dapr.io/disable-builtin-k8s-secret-store` | Disables BuiltIn Kubernetes secret store. Default value is false. See [Kubernetes secret store component]({{<ref "kubernetes-secret-store.md">}}) for details. |
|
||||
| not supported | not supported | | `dapr.io/sidecar-seccomp-profile-type` | Set the sidecar container's `securityContext.seccompProfile.type` to `Unconfined`, `RuntimeDefault`, or `Localhost`. By default, this annotation is not set on the Dapr sidecar, hence the field is omitted from sidecar container. |
|
||||
|
|
|
@ -39,6 +39,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
|--------------------|:--------:|------------|-----|---------|
|
||||
| endpoint | Y | Output | GraphQL endpoint string See [here](#url-format) for more details | `"http://localhost:4000/graphql/graphql"` |
|
||||
| header:[HEADERKEY] | N | Output | GraphQL header. Specify the header key in the `name`, and the header value in the `value`. | `"no-cache"` (see above) |
|
||||
| variable:[VARIABLEKEY] | N | Output | GraphQL query variable. Specify the variable name in the `name`, and the variable value in the `value`. | `"123"` (see below) |
|
||||
|
||||
### Endpoint and Header format
|
||||
|
||||
|
@ -65,6 +66,18 @@ Metadata: map[string]string{ "query": `query { users { name } }`},
|
|||
}
|
||||
```
|
||||
|
||||
To use a `query` that requires [query variables](https://graphql.org/learn/queries/#variables), add a key-value pair to the `metadata` map, wherein every key corresponding to a query variable is the variable name prefixed with `variable:`
|
||||
|
||||
```golang
|
||||
in := &dapr.InvokeBindingRequest{
|
||||
Name: "example.bindings.graphql",
|
||||
Operation: "query",
|
||||
Metadata: map[string]string{
|
||||
"query": `query HeroNameAndFriends($episode: string!) { hero(episode: $episode) { name } }`,
|
||||
"variable:episode": "JEDI",
|
||||
}
|
||||
```
|
||||
|
||||
## Related links
|
||||
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
|
|
|
@ -39,6 +39,8 @@ spec:
|
|||
value: 5
|
||||
- name: contentType
|
||||
value: "text/plain"
|
||||
- name: reconnectWaitInSeconds
|
||||
value: 5
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
|
@ -58,6 +60,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
| exclusive | N | Input/Output | Determines whether the topic will be an exclusive topic or not. Defaults to `"false"` | `"true"`, `"false"` |
|
||||
| maxPriority| N | Input/Output | Parameter to set the [priority queue](https://www.rabbitmq.com/priority.html). If this parameter is omitted, queue will be created as a general queue instead of a priority queue. Value between 1 and 255. See [also](#specifying-a-priority-per-message) | `"1"`, `"10"` |
|
||||
| contentType | N | Input/Output | The content type of the message. Defaults to "text/plain". | `"text/plain"`, `"application/cloudevent+json"` and so on |
|
||||
| reconnectWaitInSeconds | N | Input/Output | Represents the duration in seconds that the client should wait before attempting to reconnect to the server after a disconnection occurs. Defaults to `"5"`. | `"5"`, `"10"` |
|
||||
## Binding support
|
||||
|
||||
This component supports both **input and output** binding interfaces.
|
||||
|
|
|
@ -70,6 +70,11 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
When running the Dapr sidecar (daprd) with your application on EKS (AWS Kubernetes), if you're using a node/pod that has already been attached to an IAM policy defining access to AWS resources, you **must not** provide AWS access-key, secret-key, and tokens in the definition of the component spec you're using.
|
||||
{{% /alert %}}
|
||||
|
||||
|
||||
### S3 Bucket Creation
|
||||
{{< tabs "Minio" "LocalStack" "AWS" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
### Using with Minio
|
||||
|
||||
[Minio](https://min.io/) is a service that exposes local storage as S3-compatible block storage, and it's a popular alternative to S3 especially in development environments. You can use the S3 binding with Minio too, with some configuration tweaks:
|
||||
|
@ -78,6 +83,70 @@ When running the Dapr sidecar (daprd) with your application on EKS (AWS Kubernet
|
|||
3. The value for `region` is not important; you can set it to `us-east-1`.
|
||||
4. Depending on your environment, you may need to set `disableSSL` to `true` if you're connecting to Minio using a non-secure connection (using the `http://` protocol). If you are using a secure connection (`https://` protocol) but with a self-signed certificate, you may need to set `insecureSSL` to `true`.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
For local development, the [LocalStack project](https://github.com/localstack/localstack) is used to integrate AWS S3. Follow [these instructions](https://github.com/localstack/localstack#running) to run LocalStack.
|
||||
|
||||
To run LocalStack locally from the command line using Docker, use a `docker-compose.yaml` similar to the following:
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
localstack:
|
||||
container_name: "cont-aws-s3"
|
||||
image: localstack/localstack:1.4.0
|
||||
ports:
|
||||
- "127.0.0.1:4566:4566"
|
||||
environment:
|
||||
- DEBUG=1
|
||||
- DOCKER_HOST=unix:///var/run/docker.sock
|
||||
volumes:
|
||||
- "<PATH>/init-aws.sh:/etc/localstack/init/ready.d/init-aws.sh" # init hook
|
||||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
```
|
||||
|
||||
To use the S3 component, you need to use an existing bucket. The example above uses a [LocalStack Initialization Hook](https://docs.localstack.cloud/references/init-hooks/) to setup the bucket.
|
||||
|
||||
To use LocalStack with your S3 binding, you need to provide the `endpoint` configuration in the component metadata. The `endpoint` is unnecessary when running against production AWS.
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: aws-s3
|
||||
namespace: default
|
||||
spec:
|
||||
type: bindings.aws.s3
|
||||
version: v1
|
||||
metadata:
|
||||
- name: bucket
|
||||
value: conformance-test-docker
|
||||
- name: endpoint
|
||||
value: "http://localhost:4566"
|
||||
- name: accessKey
|
||||
value: "my-access"
|
||||
- name: secretKey
|
||||
value: "my-secret"
|
||||
- name: region
|
||||
value: "us-east-1"
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
To use the S3 component, you need to use an existing bucket. Follow the [AWS documentation for creating a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html).
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Binding support
|
||||
|
||||
This component supports **output binding** with the following operations:
|
||||
|
|
|
@ -50,9 +50,9 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
|
||||
| Field | Required | Binding support | Details | Example |
|
||||
|--------------------|:--------:|------------|-----|---------|
|
||||
| region | Y | Output | The specific AWS region | `"eu-west-1"` |
|
||||
| accessKey | Y | Output | The AWS Access Key to access this resource | `"key"` |
|
||||
| secretKey | Y | Output | The AWS Secret Access Key to access this resource | `"secretAccessKey"` |
|
||||
| region | N | Output | The specific AWS region | `"eu-west-1"` |
|
||||
| accessKey | N | Output | The AWS Access Key to access this resource | `"key"` |
|
||||
| secretKey | N | Output | The AWS Secret Access Key to access this resource | `"secretAccessKey"` |
|
||||
| sessionToken | N | Output | The AWS session token to use | `"sessionToken"` |
|
||||
| emailFrom | N | Output | If set, this specifies the email address of the sender. See [also](#example-request) | `"me@example.com"` |
|
||||
| emailTo | N | Output | If set, this specifies the email address of the receiver. See [also](#example-request) | `"me@example.com"` |
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Twitter binding spec"
|
||||
linkTitle: "Twitter"
|
||||
description: "Detailed documentation on the Twitter binding component"
|
||||
aliases:
|
||||
- "/operations/components/setup-bindings/supported-bindings/twitter/"
|
||||
---
|
||||
|
||||
{{% alert title="Deprecation notice" color="warning" %}}
|
||||
The Twitter binding component has been deprecated and will be removed in a future release. See [this GitHub issue](https://github.com/dapr/components-contrib/issues/2503) for details.
|
||||
{{% /alert %}}
|
||||
|
||||
## Component format
|
||||
|
||||
To setup Twitter binding create a component of type `bindings.twitter`. See [this guide]({{< ref "howto-bindings.md#1-create-a-binding" >}}) on how to create and apply a binding configuration.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: <NAME>
|
||||
spec:
|
||||
type: bindings.twitter
|
||||
version: v1
|
||||
metadata:
|
||||
- name: consumerKey
|
||||
value: "****" # twitter api consumer key, required
|
||||
- name: consumerSecret
|
||||
value: "****" # twitter api consumer secret, required
|
||||
- name: accessToken
|
||||
value: "****" # twitter api access token, required
|
||||
- name: accessSecret
|
||||
value: "****" # twitter api access secret, required
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
{{% /alert %}}
|
||||
|
||||
## Spec metadata fields
|
||||
|
||||
| Field | Required | Binding support | Details | Example |
|
||||
|--------------------|:--------:|------------|-----|---------|
|
||||
| consumerKey | Y | Input/Output | Twitter API consumer key | `"conusmerkey"` |
|
||||
| consumerSecret | Y | Input/Output | Twitter API consumer secret | `"conusmersecret"` |
|
||||
| accessToken | Y | Input/Output | Twitter API access token | `"accesstoken"` |
|
||||
| accessSecret | Y | Input/Output | Twitter API access secret | `"accesssecret"` |
|
||||
|
||||
## Binding support
|
||||
|
||||
This component supports both **input and output** binding interfaces.
|
||||
|
||||
This component supports **output binding** with the following operations:
|
||||
|
||||
- `get`
|
||||
|
||||
### Input binding
|
||||
|
||||
For input binding, where the query matching Tweets are streamed to the user service, the above component has to also include a query:
|
||||
|
||||
```yaml
|
||||
- name: query
|
||||
value: "dapr" # your search query, required
|
||||
```
|
||||
|
||||
### Output binding
|
||||
#### get
|
||||
|
||||
For output binding invocation the user code has to invoke the binding:
|
||||
|
||||
```shell
|
||||
POST http://localhost:3500/v1.0/bindings/twitter
|
||||
```
|
||||
|
||||
Where the payload is:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": "",
|
||||
"metadata": {
|
||||
"query": "twitter-query",
|
||||
"lang": "optional-language-code",
|
||||
"result": "valid-result-type"
|
||||
},
|
||||
"operation": "get"
|
||||
}
|
||||
```
|
||||
|
||||
The metadata parameters are:
|
||||
|
||||
- `query` - any valid Twitter query (e.g. `dapr` or `dapr AND serverless`). See [Twitter docs](https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators) for more details on advanced query formats
|
||||
- `lang` - (optional, default: `en`) restricts result tweets to the given language using [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
||||
- `result` - (optional, default: `recent`) specifies tweet query result type. Valid values include:
|
||||
- `mixed` - both popular and real time results
|
||||
- `recent` - most recent results
|
||||
- `popular` - most popular results
|
||||
|
||||
You can see the example of the JSON data that Twitter binding returns [here](https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets)
|
||||
|
||||
## Related links
|
||||
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- [Bindings building block]({{< ref bindings >}})
|
||||
- [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}})
|
||||
- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}})
|
||||
- [Bindings API reference]({{< ref bindings_api.md >}})
|
|
@ -7,11 +7,12 @@ aliases:
|
|||
- /developing-applications/middleware/supported-middleware/middleware-rate-limit/
|
||||
---
|
||||
|
||||
The rate limit [HTTP middleware]({{< ref middleware.md >}}) allows restricting the maximum number of allowed HTTP requests per second. Rate limiting can protect your application from denial of service (DOS) attacks. DOS attacks can be initiated by malicious 3rd parties but also by bugs in your software (a.k.a. a "friendly fire" DOS attack).
|
||||
The rate limit [HTTP middleware]({{< ref middleware.md >}}) allows restricting the maximum number of allowed HTTP requests per second. Rate limiting can protect your application from Denial of Service (DoS) attacks. DoS attacks can be initiated by malicious 3rd parties but also by bugs in your software (a.k.a. a "friendly fire" DoS attack).
|
||||
|
||||
## Component format
|
||||
|
||||
In the following definition, the maximum requests per second are set to 10:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
|
@ -29,11 +30,15 @@ spec:
|
|||
|
||||
| Field | Details | Example |
|
||||
|-------|---------|---------|
|
||||
| maxRequestsPerSecond | The maximum requests per second by remote IP and path. Something to consider is that **the limit is enforced independently in each Dapr sidecar and not cluster wide** | `10`
|
||||
| `maxRequestsPerSecond` | The maximum requests per second by remote IP.<br>The component looks at the `X-Forwarded-For` and `X-Real-IP` headers to determine the caller's IP. | `10`
|
||||
|
||||
Once the limit is reached, the request will return *HTTP Status code 429: Too Many Requests*.
|
||||
Once the limit is reached, the requests will fail with HTTP Status code *429: Too Many Requests*.
|
||||
|
||||
Alternatively, the [max concurrency setting]({{< ref control-concurrency.md >}}) can be used to rate limit applications and applies to all traffic regardless of remote IP or path.
|
||||
{{% alert title="Important" color="warning" %}}
|
||||
The rate limit is enforced independently in each Dapr sidecar, and not cluster-wide.
|
||||
{{% /alert %}}
|
||||
|
||||
Alternatively, the [max concurrency setting]({{< ref control-concurrency.md >}}) can be used to rate limit applications and applies to all traffic, regardless of remote IP, protocol, or path.
|
||||
|
||||
## Dapr configuration
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@ spec:
|
|||
value: service_account
|
||||
- name: projectId
|
||||
value: <PROJECT_ID> # replace
|
||||
- name: endpoint # Optional.
|
||||
value: "http://localhost:8085"
|
||||
- name: consumerID # Optional - defaults to the app's own ID
|
||||
value: <CONSUMER_ID>
|
||||
- name: identityProjectId
|
||||
value: <IDENTITY_PROJECT_ID> # replace
|
||||
- name: privateKeyId
|
||||
|
@ -46,11 +50,17 @@ spec:
|
|||
- name: disableEntityManagement
|
||||
value: "false"
|
||||
- name: enableMessageOrdering
|
||||
value: "false"
|
||||
value: "false"
|
||||
- name: orderingKey # Optional
|
||||
value: <ORDERING_KEY>
|
||||
- name: maxReconnectionAttempts # Optional
|
||||
value: 30
|
||||
- name: connectionRecoveryInSec # Optional
|
||||
value: 2
|
||||
- name: deadLetterTopic # Optional
|
||||
value: <EXISTING_PUBSUB_TOPIC>
|
||||
- name: maxDeliveryAttempts # Optional
|
||||
value: 5
|
||||
```
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
|
@ -60,8 +70,9 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| type | N | GCP credentials type. Only `service_account` is supported. Defaults to `service_account` | `service_account`
|
||||
| projectId | Y | GCP project id| `myproject-123`
|
||||
| endpoint | N | GCP endpoint for the component to use. Only used for local development (for example) with [GCP Pub/Sub Emulator](https://cloud.google.com/pubsub/docs/emulator). The `endpoint` is unnecessary when running against the GCP production API. | `"http://localhost:8085"`
|
||||
| `consumerID` | N | The Consumer ID organizes one or more consumers into a group. Consumers with the same consumer ID work as one virtual consumer; for example, a message is processed only once by one of the consumers in the group. If the consumer ID is not set, the Dapr runtime will set it to the Dapr application ID. The `consumerID`, along with the `topic` provided as part of the request, are used to build the Pub/Sub subscription ID |
|
||||
| identityProjectId | N | If the GCP pubsub project is different from the identity project, specify the identity project using this attribute | `"myproject-123"`
|
||||
| privateKeyId | N | If using explicit credentials, this field should contain the `private_key_id` field from the service account json document | `"my-private-key"`
|
||||
| privateKey | N | If using explicit credentials, this field should contain the `private_key` field from the service account json | `-----BEGIN PRIVATE KEY-----MIIBVgIBADANBgkqhkiG9w0B`
|
||||
|
@ -73,18 +84,78 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
| clientX509CertUrl | N | If using explicit credentials, this field should contain the `client_x509_cert_url` field from the service account json | `https://www.googleapis.com/robot/v1/metadata/x509/myserviceaccount%40myproject.iam.gserviceaccount.com`
|
||||
| disableEntityManagement | N | When set to `"true"`, topics and subscriptions do not get created automatically. Default: `"false"` | `"true"`, `"false"`
|
||||
| enableMessageOrdering | N | When set to `"true"`, subscribed messages will be received in order, depending on publishing and permissions configuration. | `"true"`, `"false"`
|
||||
| orderingKey |N | The key provided in the request. It's used when `enableMessageOrdering` is set to `true` to order messages based on such key. | "my-orderingkey"
|
||||
| maxReconnectionAttempts | N |Defines the maximum number of reconnect attempts. Default: `30` | `30`
|
||||
| connectionRecoveryInSec | N |Time in seconds to wait between connection recovery attempts. Default: `2` | `2`
|
||||
| deadLetterTopic | N | Name of the GCP Pub/Sub Topic. This topic **must** exist before using this component. | `"myapp-dlq"`
|
||||
| maxDeliveryAttempts | N | Maximum number of attempts to deliver the message. If `deadLetterTopic` is specified, `maxDeliveryAttempts` is the maximum number of attempts for failed processing of messages. Once that number is reached, the message will be moved to the dead-letter topic. Default: `5` | `5`
|
||||
| type | N | **DEPRECATED** GCP credentials type. Only `service_account` is supported. Defaults to `service_account` | `service_account`
|
||||
|
||||
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
If `enableMessageOrdering` is set to "true", the roles/viewer or roles/pubsub.viewer role will be required on the service account in order to guarantee ordering in cases where order tokens are not embedded in the messages. If this role is not given, or the call to Subscription.Config() fails for any other reason, ordering by embedded order tokens will still function correctly.
|
||||
{{% /alert %}}
|
||||
|
||||
## GCP Credentials
|
||||
|
||||
Since the GCP Pub/Sub component uses the GCP Go Client Libraries, by default it authenticates using **Application Default Credentials**. This is explained further in the [Authenticate to GCP Cloud services using client libraries](https://cloud.google.com/docs/authentication/client-libraries) guide.
|
||||
|
||||
## Create a GCP Pub/Sub
|
||||
|
||||
{{< tabs "Self-Hosted" "GCP" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
For local development, the [GCP Pub/Sub Emulator](https://cloud.google.com/pubsub/docs/emulator) is used to test the GCP Pub/Sub Component. Follow [these instructions](https://cloud.google.com/pubsub/docs/emulator#start) to run the GCP Pub/Sub Emulator.
|
||||
|
||||
To run the GCP Pub/Sub Emulator locally using Docker, use the following `docker-compose.yaml`:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
pubsub:
|
||||
image: gcr.io/google.com/cloudsdktool/cloud-sdk:422.0.0-emulators
|
||||
ports:
|
||||
- "8085:8085"
|
||||
container_name: gcp-pubsub
|
||||
entrypoint: gcloud beta emulators pubsub start --project local-test-prj --host-port 0.0.0.0:8085
|
||||
|
||||
```
|
||||
|
||||
In order to use the GCP Pub/Sub Emulator with your pub/sub binding, you need to provide the `endpoint` configuration in the component metadata. The `endpoint` is unnecessary when running against the GCP Production API.
|
||||
|
||||
The **projectId** attribute must match the `--project` used in either the `docker-compose.yaml` or Docker command.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: gcp-pubsub
|
||||
spec:
|
||||
type: pubsub.gcp.pubsub
|
||||
version: v1
|
||||
metadata:
|
||||
- name: projectId
|
||||
value: "local-test-prj"
|
||||
- name: consumerID
|
||||
value: "testConsumer"
|
||||
- name: endpoint
|
||||
value: "localhost:8085"
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
You can use either "explicit" or "implicit" credentials to configure access to your GCP pubsub instance. If using explicit, most fields are required. Implicit relies on dapr running under a Kubernetes service account (KSA) mapped to a Google service account (GSA) which has the necessary permissions to access pubsub. In implicit mode, only the `projectId` attribute is needed, all other are optional.
|
||||
|
||||
Follow the instructions [here](https://cloud.google.com/pubsub/docs/quickstart-console) on setting up Google Cloud Pub/Sub system.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Related links
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- Read [this guide]({{< ref "howto-publish-subscribe.md#step-2-publish-a-topic" >}}) for instructions on configuring pub/sub components
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Hazelcast"
|
||||
linkTitle: "Hazelcast"
|
||||
description: "Detailed documentation on the Hazelcast pubsub component"
|
||||
aliases:
|
||||
- "/operations/components/setup-pubsub/supported-pubsub/setup-hazelcast/"
|
||||
---
|
||||
|
||||
{{% alert title="Deprecation notice" color="warning" %}}
|
||||
The Hazelcast PubSub component has been deprecated due to inherent lack of support for "at least once" delivery guarantee, and will be removed in a future Dapr release.
|
||||
{{% /alert %}}
|
||||
|
||||
## Component format
|
||||
To setup hazelcast pubsub create a component of type `pubsub.hazelcast`. See [this guide]({{< ref "howto-publish-subscribe.md#step-1-setup-the-pubsub-component" >}}) on how to create and apply a pubsub configuration.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: hazelcast-pubsub
|
||||
spec:
|
||||
type: pubsub.hazelcast
|
||||
version: v1
|
||||
metadata:
|
||||
- name: hazelcastServers
|
||||
value: "hazelcast:3000,hazelcast2:3000"
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
{{% /alert %}}
|
||||
|
||||
## Spec metadata fields
|
||||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| connectionString | Y | A comma delimited string of servers. Example: "hazelcast:3000,hazelcast2:3000" | `"hazelcast:3000,hazelcast2:3000"`
|
||||
| backOffMaxRetries | N | The maximum number of retries to process the message before returning an error. Defaults to `"0"` which means the component will not retry processing the message. `"-1"` will retry indefinitely until the message is processed or the application is shutdown. And positive number is treated as the maximum retry count. The component will wait 5 seconds between retries. | `"3"` |
|
||||
|
||||
|
||||
## Create a Hazelcast instance
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes">}}
|
||||
|
||||
{{% codetab %}}
|
||||
You can run Hazelcast locally using Docker:
|
||||
|
||||
```
|
||||
docker run -e JAVA_OPTS="-Dhazelcast.local.publicAddress=127.0.0.1:5701" -p 5701:5701 hazelcast/hazelcast
|
||||
```
|
||||
|
||||
You can then interact with the server using the `127.0.0.1:5701`.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
The easiest way to install Hazelcast on Kubernetes is by using the [Helm chart](https://github.com/helm/charts/tree/master/stable/hazelcast).
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Related links
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- Read [this guide]({{< ref "howto-publish-subscribe.md#step-2-publish-a-topic" >}}) for instructions on configuring pub/sub components
|
||||
- [Pub/Sub building block]({{< ref pubsub >}})
|
|
@ -200,14 +200,15 @@ Setting `exchangeKind` to `"topic"` uses the topic exchanges, which are commonly
|
|||
Messages with a `routing key` will be routed to one or many queues based on the `routing key` defined in the metadata when subscribing.
|
||||
The routing key is defined by the `routingKey` metadata. For example, if an app is configured with a routing key `keyA`:
|
||||
|
||||
```
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
```yaml
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: order_pub_sub
|
||||
name: orderspubsub
|
||||
spec:
|
||||
topic: B
|
||||
route: /B
|
||||
routes:
|
||||
default: /B
|
||||
pubsubname: pubsub
|
||||
metadata:
|
||||
routingKey: keyA
|
||||
|
@ -227,14 +228,15 @@ client.PublishEvent(context.Background(), "pubsub", "B", []byte("this is another
|
|||
Multiple routing keys can be separated by commas.
|
||||
The example below binds three `routingKey`: `keyA`, `keyB`, and `""`. Note the binding method of empty keys.
|
||||
|
||||
```
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
```yaml
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: order_pub_sub
|
||||
name: orderspubsub
|
||||
spec:
|
||||
topic: B
|
||||
route: /B
|
||||
routes:
|
||||
default: /B
|
||||
pubsubname: pubsub
|
||||
metadata:
|
||||
routingKey: keyA,keyB,
|
||||
|
@ -243,6 +245,168 @@ spec:
|
|||
|
||||
For more information see [rabbitmq exchanges](https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchanges).
|
||||
|
||||
## Use priority queues
|
||||
|
||||
Dapr supports RabbitMQ [priority queues](https://www.rabbitmq.com/priority.html). To set a priority for a queue, use the `maxPriority` topic subscription metadata.
|
||||
|
||||
### Declarative priority queue example
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: pubsub
|
||||
spec:
|
||||
topic: checkout
|
||||
routes:
|
||||
default: /orders
|
||||
pubsubname: order-pub-sub
|
||||
metadata:
|
||||
maxPriority: 3
|
||||
```
|
||||
|
||||
### Programmatic priority queue example
|
||||
|
||||
{{< tabs Python JavaScript Go>}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```python
|
||||
@app.route('/dapr/subscribe', methods=['GET'])
|
||||
def subscribe():
|
||||
subscriptions = [
|
||||
{
|
||||
'pubsubname': 'pubsub',
|
||||
'topic': 'checkout',
|
||||
'routes': {
|
||||
'default': '/orders'
|
||||
},
|
||||
'metadata': {'maxPriority': '3'}
|
||||
}
|
||||
]
|
||||
return jsonify(subscriptions)
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```javascript
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
const app = express()
|
||||
app.use(bodyParser.json({ type: 'application/*+json' }));
|
||||
|
||||
const port = 3000
|
||||
|
||||
app.get('/dapr/subscribe', (req, res) => {
|
||||
res.json([
|
||||
{
|
||||
pubsubname: "pubsub",
|
||||
topic: "checkout",
|
||||
routes: {
|
||||
default: '/orders'
|
||||
},
|
||||
metadata: {
|
||||
maxPriority: '3'
|
||||
}
|
||||
}
|
||||
]);
|
||||
})
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
const appPort = 3000
|
||||
|
||||
type subscription struct {
|
||||
PubsubName string `json:"pubsubname"`
|
||||
Topic string `json:"topic"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
Routes routes `json:"routes"`
|
||||
}
|
||||
|
||||
type routes struct {
|
||||
Rules []rule `json:"rules,omitempty"`
|
||||
Default string `json:"default,omitempty"`
|
||||
}
|
||||
|
||||
// This handles /dapr/subscribe
|
||||
func configureSubscribeHandler(w http.ResponseWriter, _ *http.Request) {
|
||||
t := []subscription{
|
||||
{
|
||||
PubsubName: "pubsub",
|
||||
Topic: "checkout",
|
||||
Routes: routes{
|
||||
Default: "/orders",
|
||||
},
|
||||
Metadata: map[string]string{
|
||||
"maxPriority": "3"
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(t)
|
||||
}
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
### Setting a priority when publishing a message
|
||||
|
||||
To set a priority on a message, add the publish metadata key `maxPriority` to the publish endpoint or SDK method.
|
||||
|
||||
{{< tabs "HTTP API (Bash)" Python JavaScript Go>}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:3601/v1.0/publish/order-pub-sub/orders?metadata.maxPriority=3 -H "Content-Type: application/json" -d '{"orderId": "100"}'
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```python
|
||||
with DaprClient() as client:
|
||||
result = client.publish_event(
|
||||
pubsub_name=PUBSUB_NAME,
|
||||
topic_name=TOPIC_NAME,
|
||||
data=json.dumps(orderId),
|
||||
data_content_type='application/json',
|
||||
metadata= { 'maxPriority': '3' })
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```javascript
|
||||
await client.pubsub.publish(PUBSUB_NAME, TOPIC_NAME, orderId, { 'maxPriority': '3' });
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```go
|
||||
client.PublishEvent(ctx, PUBSUB_NAME, TOPIC_NAME, []byte(strconv.Itoa(orderId)), map[string]string{"maxPriority": "3"})
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Related links
|
||||
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}}) in the Related links section
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Etcd"
|
||||
linkTitle: "Etcd"
|
||||
description: Detailed information on the Etcd state store component
|
||||
aliases:
|
||||
- "/operations/components/setup-state-store/supported-state-stores/setup-etcd/"
|
||||
---
|
||||
|
||||
## Component format
|
||||
|
||||
To setup Etcd state store create a component of type `state.etcd`. See [this guide]({{< ref "howto-get-save-state.md#step-1-setup-a-state-store" >}}) on how to create and apply a state store configuration.
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: <NAME>
|
||||
spec:
|
||||
type: state.etcd
|
||||
version: v1
|
||||
metadata:
|
||||
- name: endpoints
|
||||
value: <CONNECTION STRING> # Required. Example: 192.168.0.1:2379,192.168.0.2:2379,192.168.0.3:2379
|
||||
- name: keyPrefixPath
|
||||
value: <KEY PREFIX STRING> # Optional. default: "". Example: "dapr"
|
||||
- name: tlsEnable
|
||||
value: <ENABLE TLS> # Optional. Example: "false"
|
||||
- name: ca
|
||||
value: <CA> # Optional. Required if tlsEnable is `true`.
|
||||
- name: cert
|
||||
value: <CERT> # Optional. Required if tlsEnable is `true`.
|
||||
- name: key
|
||||
value: <KEY> # Optional. Required if tlsEnable is `true`.
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
{{% /alert %}}
|
||||
|
||||
## Spec metadata fields
|
||||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| endpoints | Y | Connection string to Etcd server | `"192.168.0.1:2379,192.168.0.2:2379,192.168.0.3:2379"`
|
||||
| keyPrefixPath | N | Key prefix path in Etcd. Default is `""` | `"dapr"`
|
||||
| tlsEnable | N | Whether to enable tls | `"false"`
|
||||
| ca | N | Contents of Etcd server CA file. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN CERTIFICATE-----\nMIIC9TCCA..."`
|
||||
| cert | N | Contents of Etcd server certificate file. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN CERTIFICATE-----\nMIIDUTCC..."`
|
||||
| key | N | Contents of Etcd server key file. Can be `secretKeyRef` to use a [secret reference]({{< ref component-secrets.md >}}).| `"-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIB..."`
|
||||
|
||||
## Setup Etcd
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
You can run Etcd database locally using Docker Compose. Create a new file called `docker-compose.yml` and add the following contents as an example:
|
||||
|
||||
```
|
||||
version: '2'
|
||||
services:
|
||||
etcd:
|
||||
image: gcr.io/etcd-development/etcd:v3.4.20
|
||||
ports:
|
||||
- "2379:2379"
|
||||
command: etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379```
|
||||
```
|
||||
Save the `docker-compose.yml` file and run the following command to start the Etcd server:
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
This starts the Etcd server in the background and expose the default Etcd port of `2379`. You can then interact with the server using the `etcdctl` command-line client on `localhost:12379`. For example:
|
||||
|
||||
```
|
||||
etcdctl --endpoints=localhost:2379 put mykey myvalue
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
Use [Helm](https://helm.sh/) to quickly create an Etcd instance in your Kubernetes cluster. This approach requires [Installing Helm](https://github.com/helm/helm#install).
|
||||
|
||||
Follow the [Bitnami instructions](https://github.com/bitnami/charts/tree/main/bitnami/etcd) to get started with setting up Etcd in Kubernetes.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Related links
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- Read [this guide]({{< ref "howto-get-save-state.md#step-2-save-and-retrieve-a-single-state" >}}) for instructions on configuring state store components
|
||||
- [State management building block]({{< ref state-management >}})
|
|
@ -21,30 +21,32 @@ spec:
|
|||
type: state.gcp.firestore
|
||||
version: v1
|
||||
metadata:
|
||||
- name: type
|
||||
value: <REPLACE-WITH-CREDENTIALS-TYPE> # Required. Example: "serviceaccount"
|
||||
- name: project_id
|
||||
value: <REPLACE-WITH-PROJECT-ID> # Required.
|
||||
- name: endpoint # Optional.
|
||||
value: "http://localhost:8432"
|
||||
- name: private_key_id
|
||||
value: <REPLACE-WITH-PRIVATE-KEY-ID> # Required.
|
||||
value: <REPLACE-WITH-PRIVATE-KEY-ID> # Optional.
|
||||
- name: private_key
|
||||
value: <REPLACE-WITH-PRIVATE-KEY> # Required.
|
||||
value: <REPLACE-WITH-PRIVATE-KEY> # Optional, but Required if `private_key_id` is specified.
|
||||
- name: client_email
|
||||
value: <REPLACE-WITH-CLIENT-EMAIL> # Required.
|
||||
value: <REPLACE-WITH-CLIENT-EMAIL> # Optional, but Required if `private_key_id` is specified.
|
||||
- name: client_id
|
||||
value: <REPLACE-WITH-CLIENT-ID> # Required.
|
||||
value: <REPLACE-WITH-CLIENT-ID> # Optional, but Required if `private_key_id` is specified.
|
||||
- name: auth_uri
|
||||
value: <REPLACE-WITH-AUTH-URI> # Required.
|
||||
value: <REPLACE-WITH-AUTH-URI> # Optional.
|
||||
- name: token_uri
|
||||
value: <REPLACE-WITH-TOKEN-URI> # Required.
|
||||
value: <REPLACE-WITH-TOKEN-URI> # Optional.
|
||||
- name: auth_provider_x509_cert_url
|
||||
value: <REPLACE-WITH-AUTH-X509-CERT-URL> # Required.
|
||||
value: <REPLACE-WITH-AUTH-X509-CERT-URL> # Optional.
|
||||
- name: client_x509_cert_url
|
||||
value: <REPLACE-WITH-CLIENT-x509-CERT-URL> # Required.
|
||||
value: <REPLACE-WITH-CLIENT-x509-CERT-URL> # Optional.
|
||||
- name: entity_kind
|
||||
value: <REPLACE-WITH-ENTITY-KIND> # Optional. default: "DaprState"
|
||||
- name: noindex
|
||||
value: <REPLACE-WITH-BOOLEAN> # Optional. default: "false"
|
||||
- name: type
|
||||
value: <REPLACE-WITH-CREDENTIALS-TYPE> # Deprecated.
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
|
@ -55,17 +57,23 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| type | Y | The credentials type | `"serviceaccount"`
|
||||
| project_id | Y | The ID of the GCP project to use | `"project-id"`
|
||||
| private_key_id | Y | The ID of the prvate key to use | `"private-key-id"`
|
||||
| client_email | Y | The email address for the client | `"eample@example.com"`
|
||||
| client_id | Y | The client id value to use for authentication | `"client-id"`
|
||||
| auth_uri | Y | The authentication URI to use | `"https://accounts.google.com/o/oauth2/auth"`
|
||||
| token_uri | Y | The token URI to query for Auth token | `"https://oauth2.googleapis.com/token"`
|
||||
| auth_provider_x509_cert_url | Y | The auth provider certificate URL | `"https://www.googleapis.com/oauth2/v1/certs"`
|
||||
| client_x509_cert_url | Y | The client certificate URL | `"https://www.googleapis.com/robot/v1/metadata/x509/x"`
|
||||
| endpoint | N | GCP endpoint for the component to use. Only used for local development with (for example) [GCP Datastore Emulator](https://cloud.google.com/datastore/docs/tools/datastore-emulator). The `endpoint` is unnecessary when running against the GCP production API. | `"localhost:8432"`
|
||||
| private_key_id | N | The ID of the prvate key to use | `"private-key-id"`
|
||||
| privateKey | N | If using explicit credentials, this field should contain the `private_key` field from the service account json | `-----BEGIN PRIVATE KEY-----MIIBVgIBADANBgkqhkiG9w0B`
|
||||
| client_email | N | The email address for the client | `"eample@example.com"`
|
||||
| client_id | N | The client id value to use for authentication | `"client-id"`
|
||||
| auth_uri | N | The authentication URI to use | `"https://accounts.google.com/o/oauth2/auth"`
|
||||
| token_uri | N | The token URI to query for Auth token | `"https://oauth2.googleapis.com/token"`
|
||||
| auth_provider_x509_cert_url | N | The auth provider certificate URL | `"https://www.googleapis.com/oauth2/v1/certs"`
|
||||
| client_x509_cert_url | N | The client certificate URL | `"https://www.googleapis.com/robot/v1/metadata/x509/x"`
|
||||
| entity_kind | N | The entity name in Filestore. Defaults to `"DaprState"` | `"DaprState"`
|
||||
| noindex | N | Whether to disable indexing of state entities. Use this setting if you encounter Firestore index size limitations. Defaults to `"false"` | `"true"`
|
||||
| type | N | **DEPRECATED** The credentials type | `"serviceaccount"`
|
||||
|
||||
|
||||
## GCP Credentials
|
||||
Since the GCP Firestore component uses the GCP Go Client Libraries, by default it authenticates using **Application Default Credentials**. This is explained in the [Authenticate to GCP Cloud services using client libraries](https://cloud.google.com/docs/authentication/client-libraries) guide.
|
||||
|
||||
## Setup GCP Firestore
|
||||
|
||||
|
@ -74,7 +82,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|
|||
{{% codetab %}}
|
||||
You can use the GCP Datastore emulator to run locally using the instructions [here](https://cloud.google.com/datastore/docs/tools/datastore-emulator).
|
||||
|
||||
You can then interact with the server using `localhost:8081`.
|
||||
You can then interact with the server using `http://localhost:8432`.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
|
|
@ -112,6 +112,10 @@ The username is `admin` by default.
|
|||
|
||||
{{< /tabs >}}
|
||||
|
||||
### TTLs and cleanups
|
||||
|
||||
This state store supports [Time-To-Live (TTL)]({{< ref state-store-ttl.md >}}) for records stored with Dapr. When storing data using Dapr, you can set the `ttlInSeconds` metadata property to indicate when the data should be considered "expired".
|
||||
|
||||
## Related links
|
||||
- [Basic schema for a Dapr component]({{< ref component-schema >}})
|
||||
- Read [this guide]({{< ref "howto-get-save-state.md#step-2-save-and-retrieve-a-single-state" >}}) for instructions on configuring state store components
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
output: true
|
||||
- component: AWS S3
|
||||
link: s3
|
||||
state: Alpha
|
||||
state: Stable
|
||||
version: v1
|
||||
since: "1.0"
|
||||
features:
|
||||
|
|
|
@ -118,14 +118,6 @@
|
|||
features:
|
||||
input: false
|
||||
output: true
|
||||
- component: Twitter
|
||||
link: twitter
|
||||
state: Alpha
|
||||
version: v1
|
||||
since: "1.0"
|
||||
features:
|
||||
input: true
|
||||
output: true
|
||||
- component: SendGrid
|
||||
link: sendgrid
|
||||
state: Alpha
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- component: Rate limit
|
||||
link: middleware-rate-limit
|
||||
state: Alpha
|
||||
state: Stable
|
||||
version: v1
|
||||
description: Restricts the maximum number of allowed HTTP requests per second
|
||||
- component: OAuth2 Authorization Grant flow
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- component: GCP Pub/Sub
|
||||
link: setup-gcp-pubsub
|
||||
state: Alpha
|
||||
state: Stable
|
||||
version: v1
|
||||
since: "1.0"
|
||||
features:
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
- component: Hazelcast
|
||||
link: setup-hazelcast
|
||||
state: Deprecated
|
||||
version: v1
|
||||
since: "1.9"
|
||||
features:
|
||||
bulkPublish: false
|
||||
bulkSubscribe: false
|
||||
- component: In-memory
|
||||
link: setup-inmemory
|
||||
state: Beta
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
since: "1.10"
|
||||
features:
|
||||
crud: true
|
||||
transactions: false
|
||||
transactions: true
|
||||
etag: true
|
||||
ttl: true
|
||||
query: false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- component: GCP Firestore
|
||||
link: setup-firestore
|
||||
state: Alpha
|
||||
state: Stable
|
||||
version: v1
|
||||
since: "1.0"
|
||||
features:
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
crud: true
|
||||
transactions: true
|
||||
etag: true
|
||||
ttl: false
|
||||
ttl: true
|
||||
query: true
|
||||
- component: MySQL
|
||||
link: setup-mysql
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f9571d5b34f5b1f41a06ba9b9b4da0c2c0f3fb36
|
||||
Subproject commit ae34854397150715fe440dec831461d70e17d07a
|
|
@ -0,0 +1 @@
|
|||
Subproject commit dbb1a9526875e8df6af1823e09dae11216221444
|
Loading…
Reference in New Issue