Merge branch 'v1.8' into v1.8

This commit is contained in:
Mark Fussell 2022-06-24 16:44:41 -07:00 committed by GitHub
commit e60c7a52f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 344 additions and 36 deletions

View File

@ -6,33 +6,12 @@ weight: 2300
description: "Learn how to route messages from a topic to different event handlers based on CloudEvent fields"
---
{{% alert title="Preview feature" color="warning" %}}
Pub/sub message routing is currently in [preview]({{< ref preview-features.md >}}).
{{% /alert %}}
Pub/sub routing is an implementation of [content-based routing](https://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html), a messaging pattern that utilizes a DSL instead of imperative application code. With pub/sub routing, you use expressions to route [CloudEvents](https://cloudevents.io) (based on their contents) to different URIs/paths and event handlers in your application. If no route matches, then an optional default route is used. This proves useful as your applications expand to support multiple event versions or special cases.
While routing can be implemented with code, keeping routing rules external from the application can improve portability.
This feature is available to both the [declarative and programmatic subscription approaches]({{< ref subscription-methods.md >}}).
## Enable message routing
To enable this preview feature, add the `PubSub.Routing` feature entry to your application configuration:
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: pubsubroutingconfig
spec:
features:
- name: PubSub.Routing
enabled: true
```
Learn more about enabling [preview features]({{< ref preview-features >}}).
## Declarative subscription
For declarative subscriptions, use `dapr.io/v2alpha1` as the `apiVersion`. Here is an example of `subscriptions.yaml` using routing:

View File

@ -15,8 +15,7 @@ For CLI there is no explicit opt-in, just the version that this was first made a
## Current preview features
| Feature | Description | Setting | Documentation | Version introduced |
| ---------- |-------------|---------|---------------|-----------------|
| **Pub/Sub routing** | Allow the use of expressions to route cloud events to different URIs/paths and event handlers in your application. | `PubSub.Routing` | [How-To: Publish a message and subscribe to a topic]({{<ref howto-route-messages>}}) | v1.4 |
| **--image-registry** flag with Dapr CLI| In self hosted mode you can set this flag to specify any private registry to pull the container images required to install Dapr| N/A | [init CLI command reference]({{<ref "dapr-init.md#self-hosted-environment" >}}) | v1.7 |
| **Resiliency** | Allows configuring of fine-grained policies for retries, timeouts and circuitbreaking. | `Resiliency` | [Configure Resiliency Policies]({{<ref "resiliency-overview">}}) |
| **Resiliency** | Allows configuring of fine-grained policies for retries, timeouts and circuitbreaking. | `Resiliency` | [Configure Resiliency Policies]({{<ref "resiliency-overview">}}) | v1.7|
| **Service invocation without default `content-type`** | When enabled removes the default service invocation content-type header value `application/json` when no content-type is provided. This will become the default behavior in release v1.9.0. This requires you to explictly set content-type headers where required for your apps. | `ServiceInvocation.NoDefaultContentType` | [Service Invocation]({{<ref "service_invocation_api.md#request-contents" >}}) | v1.7 |

View File

@ -0,0 +1,234 @@
---
type: docs
title: "Configuration API reference"
linkTitle: "Configuration API"
description: "Detailed documentation on the configuration API"
weight: 650
---
## Get Configuration
This endpoint lets you get configuration from a store.
### HTTP Request
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/<storename>
```
#### URL Parameters
Parameter | Description
--------- | -----------
`daprPort` | The Dapr port
`storename` | The `metadata.name` field component file. Refer to the [component schema] ({{< ref component-schema.md>}})
#### Query Parameters
If no query parameters are provided, all configuration items are returned.
To specifiy the keys of the configuration items to get, use one or more `key` query parameters. For example:
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/mystore?key=config1&key=config2
```
To retrieve all configuration items:
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/mystore
```
#### Request Body
None
### HTTP Response
#### Response Codes
Code | Description
---- | -----------
`204` | Get operation successful
`400` | Configuration store is missing or misconfigured or malformed request
`500` | Failed to get configuration
#### Response Body
JSON-encoded value of key/value pairs for each configuration item.
### Example
```shell
curl -X GET 'http://localhost:3500/v1.0-alpha1/configuration/mystore?key=myConfigKey'
```
> The above command returns the following JSON:
```json
[{"key":"myConfigKey","value":"myConfigValue"}]
```
## Subscribe Configuration
This endpoint lets you subscribe to configuration changes. Notifications happen when values are updated or deleted in the configuration store. This enables the application to react to configuration changes.
### HTTP Request
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/<storename>/subscribe
```
#### URL Parameters
Parameter | Description
--------- | -----------
`daprPort` | The Dapr port
`storename` | The `metadata.name` field component file. Refer to the [component schema] ({{< ref component-schema.md>}})
#### Query Parameters
If no query parameters are provided, all configuration items are subscribed to.
To specifiy the keys of the configuration items to subscribe to, use one or more `key` query parameters. For example:
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/mystore/subscribe?key=config1&key=config2
```
To subscribe to all changes:
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/mystore/subscribe
```
#### Request Body
None
### HTTP Response
#### Response Codes
Code | Description
---- | -----------
`200` | Subscribe operation successful
`400` | Configuration store is missing or misconfigured or malformed request
`500` | Failed to subscribe to configuration changes
#### Response Body
JSON-encoded value
### Example
```shell
curl -X GET 'http://localhost:3500/v1.0-alpha1/configuration/mystore/subscribe?key=myConfigKey'
```
> The above command returns the following JSON:
```json
{
"id": "<unique-id>"
}
```
The returned `id` parameter can be used to unsubscribe to the specific set of keys provided on the subscribe API call. This should be retained by the application.
## Unsubscribe Configuration
This endpoint lets you unsubscribe to configuration changes.
### HTTP Request
```
GET http://localhost:<daprPort>/v1.0-alpha1/configuration/<subscription-id>/unsubscribe
```
#### URL Parameters
Parameter | Description
--------- | -----------
`daprPort` | The Dapr port
`subscription-id` | The value from the `id` field returned from the response of the subscribe endpoint
#### Query Parameters
None
#### Request Body
None
### HTTP Response
#### Response Codes
Code | Description
---- | -----------
`204` | Unsubscribe operation successful
`400` | Configuration store is missing or misconfigured or malformed request
`500` | Failed to unsubscribe to configuration changes
#### Response Body
None
### Example
```shell
curl -X GET 'http://localhost:3500/v1.0-alpha1/configuration/bf3aa454-312d-403c-af95-6dec65058fa2/unsubscribe'
```
## Optional application (user code) routes
### Provide a route for Dapr to send configuration changes
subscribing to configuration changes, Dapr invokes the application whenever a configuration item changes. Your application can have a `/configuration` endpoint that is called for all key updates that are subscribed to. The endpoint(s) can be made more specific for a given configuration store by adding `/<store-name>` and for a specific key by adding `/<store-name>/<key>` to the route.
#### HTTP Request
```
POST http://localhost:<appPort>/configuration/<store-name>/<key>
```
#### URL Parameters
Parameter | Description
--------- | -----------
`appPort` | The application port
`storename` | The `metadata.name` field component file. Refer to the [component schema] ({{< ref component-schema.md>}})
`key` | The key subscribed to
#### Request Body
A list of configuration items for a given subscription id. Configuration items can have a version associated with them, which is returned in the notification.
```json
{
"id": "<subscription-id>",
"items": [
"key": "<key-of-configuration-item>",
"value": "<new-value>",
"version": "<version-of-item>"
]
}
```
#### Example
```json
{
"id": "bf3aa454-312d-403c-af95-6dec65058fa2",
"items": [
"key": "config-1",
"value": "abcdefgh",
"version": "1.1"
]
}
```
## Next Steps
- [Configuration API overview]({{< ref configuration-api-overview.md >}})
- [How-To: Manage configuration from a store]({{< ref howto-manage-configuration.md >}})

View File

@ -24,10 +24,18 @@ spec:
metadata:
- name: emailFrom
value: "testapp@dapr.io" # optional
- name: emailFromName
value: "test app" # optional
- name: emailTo
value: "dave@dapr.io" # optional
- name: emailToName
value: "dave" # optional
- name: subject
value: "Hello!" # optional
- name: emailCc
value: "jill@dapr.io" # optional
- name: emailBcc
value: "bob@dapr.io" # optional
- name: apiKey
value: "YOUR_API_KEY" # required, this is your SendGrid key
```
@ -41,10 +49,12 @@ The above example uses secrets as plain strings. It is recommended to use a secr
| Field | Required | Binding support | Details | Example |
|--------------------|:--------:|------------|-----|---------|
| apiKey | Y | Output | SendGrid API key, this should be considered a secret value | `"apikey"` |
| emailFrom | N | Output | If set this specifies the 'from' email address of the email message. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailTo | N | Output | If set this specifies the 'to' email address of the email message. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailCc | N | Output | If set this specifies the 'cc' email address of the email message. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailBcc | N | Output | If set this specifies the 'bcc' email address of the email message. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailFrom | N | Output | If set this specifies the 'from' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailFromName | N | Output | If set this specifies the 'from' name of the email message. Optional field, see [below](#example-request-payload) | `"me"` |
| emailTo | N | Output | If set this specifies the 'to' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailToName | N | Output | If set this specifies the 'to' name of the email message. Optional field, see [below](#example-request-payload) | `"me"` |
| emailCc | N | Output | If set this specifies the 'cc' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| emailBcc | N | Output | If set this specifies the 'bcc' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| subject | N | Output | If set this specifies the subject of the email message. Optional field, see [below](#example-request-payload) | `"subject of the email"` |

View File

@ -0,0 +1,61 @@
---
type: docs
title: "WASM"
linkTitle: "WASM"
description: "Use WASM middleware in your HTTP pipeline"
aliases:
- /developing-applications/middleware/supported-middleware/middleware-wasm/
---
The WASM [HTTP middleware]({{< ref middleware.md >}}) component enables you to use a WASM module to handle requests and responses.
Using WASM modules allow developers to write middleware components in any WASM supported language and extend Dapr using external files that are not pre-compiled into the `daprd` binary.
WASM modules are loaded from a filesystem path. On Kubernetes, see [mounting volumes to the Dapr sidecar]({{> kubernetes-volume-mounts.md >}}) to configure a filesystem mount that can contain WASM modules.
## Component format
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: wasm
spec:
type: middleware.http.wasm.basic
version: v1
metadata:
- name: path
value: "./hello.wasm"
- name: runtime
value: "wazero"
```
## Spec metadata fields
| Field | Details | Example |
|-------|---------|---------|
| path | A relative or absolute path to the WASM module | "./hello.wasm" |
| runtime | The WASM runtime of your WASM binary. Only `wazero` is supported | ["wazero"](https://github.com/tetratelabs/wazero) |
## Dapr configuration
To be applied, the middleware must be referenced in [configuration]({{< ref configuration-concept.md >}}). See [middleware pipelines]({{< ref "middleware.md#customize-processing-pipeline">}}).
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: appconfig
spec:
httpPipeline:
handlers:
- name: wasm
type: middleware.http.wasm.basic
```
## Related links
- [Middleware]({{< ref middleware.md >}})
- [Configuration concept]({{< ref configuration-concept.md >}})
- [Configuration overview]({{< ref configuration-overview.md >}})

View File

@ -47,7 +47,7 @@ If you wish to use Cosmos DB as an actor store, append the following to the yam
| Field | Required | Details | Example |
|--------------------|:--------:|---------|---------|
| url | Y | The Cosmos DB url | `"https://******.documents.azure.com:443/"`.
| masterKey | Y | The key to authenticate to the Cosmos DB account | `"key"`
| masterKey | Y* | The key to authenticate to the Cosmos DB account. Only required when not using Azure AD authentication. | `"key"`
| database | Y | The name of the database | `"db"`
| collection | Y | The name of the collection (container) | `"collection"`
| actorStateStore | N | Consider this state store for actors. Defaults to `"false"` | `"true"`, `"false"`
@ -67,7 +67,7 @@ You can read additional information for setting up Cosmos DB with Azure AD aut
In order to setup Cosmos DB as a state store, you need the following properties:
- **URL**: the Cosmos DB url. for example: `https://******.documents.azure.com:443/`
- **Master Key**: The key to authenticate to the Cosmos DB account
- **Master Key**: The key to authenticate to the Cosmos DB account. Skip this if using Azure AD authentication.
- **Database**: The name of the database
- **Collection**: The name of the collection (or container)

View File

@ -2,7 +2,7 @@
type: docs
title: "Azure Table Storage "
linkTitle: "Azure Table Storage "
description: Detailed information on the Azure Table Storage state store component
description: Detailed information on the Azure Table Storage state store component which can be used to connect to Cosmos DB Table API and Azure Tables
aliases:
- "/operations/components/setup-state-store/supported-state-stores/setup-azure-tablestorage/"
---
@ -27,6 +27,8 @@ spec:
value: <REPLACE-WITH-ACCOUNT-KEY>
- name: tableName
value: <REPLACE-WITH-TABLE-NAME>
- name: cosmosDbMode
value: false
```
{{% alert title="Warning" color="warning" %}}
@ -39,18 +41,41 @@ The above example uses secrets as plain strings. It is recommended to use a secr
|--------------------|:--------:|---------|---------|
| accountName | Y | The storage account name | `"mystorageaccount"`.
| accountKey | Y | Primary or secondary storage key | `"key"`
| tableName | Y | The name of the table to be used for Dapr state. The table will be created for you if it doesn't exist | `"table"`
| tableName | Y | The name of the table to be used for Dapr state. The table will be created for you if it doesn't exist | `"table"`
| cosmosDbMode | N | If enabled, connects to Cosmos DB Table API instead of Azure Tables (Storage Accounts). Defaults to `false`. | `"false"`
| serviceURL | N | The full storage service endpoint URL. Useful for Azure environments other than public cloud. | `"https://mystorageaccount.table.core.windows.net/"`
| skipCreateTable | N | Skips the check for and, if necessary, creation of the specified storage table. This is useful when using active directory authentication with minimal privileges. Defaults to `false`. | `"true"`
## Setup Azure Table Storage
### Azure Active Directory (Azure AD) authentication
The Azure Cosmos DB state store component supports authentication using all Azure Active Directory mechanisms. For further information and the relevant component metadata fields to provide depending on the choice of Azure AD authentication mechanism, see the [docs for authenticating to Azure]({{< ref authenticating-azure.md >}}).
You can read additional information for setting up Cosmos DB with Azure AD authentication in the [section below](#setting-up-cosmos-db-for-authenticating-with-azure-ad).
## Option 1: Setup Azure Table Storage
[Follow the instructions](https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal) from the Azure documentation on how to create an Azure Storage Account.
If you wish to create a table for Dapr to use, you can do so beforehand. However, Table Storage state provider will create one for you automatically if it doesn't exist.
If you wish to create a table for Dapr to use, you can do so beforehand. However, Table Storage state provider will create one for you automatically if it doesn't exist, unless the `skipCreateTable` option is enabled.
In order to setup Azure Table Storage as a state store, you will need the following properties:
- **AccountName**: The storage account name. For example: **mystorageaccount**.
- **AccountKey**: Primary or secondary storage key.
- **TableName**: The name of the table to be used for Dapr state. The table will be created for you if it doesn't exist.
- **AccountKey**: Primary or secondary storage key. Skip this if using Azure AD authentication.
- **TableName**: The name of the table to be used for Dapr state. The table will be created for you if it doesn't exist, unless the `skipCreateTable` option is enabled.
- **cosmosDbMode**: Set this to `false` to connect to Azure Tables.
## Option 2: Setup Azure Cosmos DB Table API
[Follow the instructions](https://docs.microsoft.com/azure/cosmos-db/table/how-to-use-python?tabs=azure-portal#1---create-an-azure-cosmos-db-account) from the Azure documentation on creating a Cosmos DB account with Table API.
If you wish to create a table for Dapr to use, you can do so beforehand. However, Table Storage state provider will create one for you automatically if it doesn't exist, unless the `skipCreateTable` option is enabled.
In order to setup Azure Cosmos DB Table API as a state store, you will need the following properties:
- **AccountName**: The Cosmos DB account name. For example: **mycosmosaccount**.
- **AccountKey**: The Cosmos DB master key. Skip this if using Azure AD authentication.
- **TableName**: The name of the table to be used for Dapr state. The table will be created for you if it doesn't exist, unless the `skipCreateTable` option is enabled.
- **cosmosDbMode**: Set this to `true` to connect to Azure Tables.
## Partitioning

@ -1 +1 @@
Subproject commit eb6ee2eeb9faf3d5a4cf353a11d468dd81ea0490
Subproject commit 5f6fd57d28ecc676dce2c22530190af21ca7d63c