mirror of https://github.com/dapr/docs.git
Merge branch 'v1.11' into issue_3239
This commit is contained in:
commit
64f961a043
|
@ -25,13 +25,14 @@ The diagram below is an example of how dead letter topics work. First a message
|
|||
The following YAML shows how to configure a subscription with a dead letter topic named `poisonMessages` for messages consumed from the `orders` topic. This subscription is scoped to an app with a `checkout` ID.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: order
|
||||
spec:
|
||||
topic: orders
|
||||
route: /checkout
|
||||
routes:
|
||||
default: /checkout
|
||||
pubsubname: pubsub
|
||||
deadLetterTopic: poisonMessages
|
||||
scopes:
|
||||
|
@ -86,13 +87,16 @@ spec:
|
|||
Remember to now configure a subscription to handling the dead letter topics. For example you can create another declarative subscription to receive these on the same or a different application. The example below shows the checkout application subscribing to the `poisonMessages` topic with another subscription and sending these to be handled by the `/failedmessages` endpoint.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: deadlettertopics
|
||||
spec:
|
||||
topic: poisonMessages
|
||||
route: /failedMessages
|
||||
routes:
|
||||
rules:
|
||||
- match:
|
||||
path: /failedMessages
|
||||
pubsubname: pubsub
|
||||
scopes:
|
||||
- checkout
|
||||
|
|
|
@ -141,13 +141,14 @@ $app->start();
|
|||
Similarly, you can subscribe to raw events declaratively by adding the `rawPayload` metadata entry to your subscription specification.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: myevent-subscription
|
||||
spec:
|
||||
topic: deathStarStatus
|
||||
route: /dsstatus
|
||||
routes:
|
||||
default: /dsstatus
|
||||
pubsubname: pubsub
|
||||
metadata:
|
||||
rawPayload: "true"
|
||||
|
|
|
@ -22,13 +22,14 @@ The examples below demonstrate pub/sub messaging between a `checkout` app and an
|
|||
You can subscribe declaratively to a topic using an external component file. This example uses a YAML component file named `subscription.yaml`:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: order
|
||||
spec:
|
||||
topic: orders
|
||||
route: /checkout
|
||||
routes:
|
||||
default: /checkout
|
||||
pubsubname: pubsub
|
||||
scopes:
|
||||
- orderprocessing
|
||||
|
|
|
@ -47,7 +47,7 @@ The diagram below is an overview of how Dapr's service invocation works when inv
|
|||
## Using an HTTPEndpoint resource or FQDN URL for non-Dapr endpoints
|
||||
There are two ways to invoke a non-Dapr endpoint when communicating either to Dapr applications or non-Dapr applications. A Dapr application can invoke a non-Dapr endpoint by providing one of the following:
|
||||
|
||||
- A named `HTTPEndpoint` resource, including defining an `HTTPEndpoint` resource type. See the [HTTPEndpoint reference]({{< ref httpendpoints-reference.md >}}) guide for an example.
|
||||
- A named `HTTPEndpoint` resource, including defining an `HTTPEndpoint` resource type. See the [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}}) guide for an example.
|
||||
|
||||
```sh
|
||||
localhost:3500/v1.0/invoke/<HTTPEndpoint-name>/method/<my-method>
|
||||
|
@ -81,7 +81,7 @@ curl http://localhost:3602/v1.0/invoke/orderprocessor/method/checkout
|
|||
|
||||
## Related Links
|
||||
|
||||
- [HTTPEndpoint reference]({{< ref httpendpoints-reference.md >}})
|
||||
- [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}})
|
||||
- [Service invocation overview]({{< ref service-invocation-overview.md >}})
|
||||
- [Service invocation API specification]({{< ref service_invocation_api.md >}})
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Component schema"
|
||||
linkTitle: "Component schema"
|
||||
weight: 100
|
||||
description: "The basic schema for a Dapr component"
|
||||
title: "Component spec"
|
||||
linkTitle: "Component"
|
||||
weight: 1000
|
||||
description: "The basic spec for a Dapr component"
|
||||
---
|
||||
|
||||
Dapr defines and registers components using a [CustomResourceDefinition](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). All components are defined as a CRD and can be applied to any hosting environment where Dapr is running, not just Kubernetes.
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
type: docs
|
||||
title: "HTTPEndpoint spec"
|
||||
linkTitle: "HTTPEndpoint spec"
|
||||
description: "The HTTPEndpoint resource spec"
|
||||
weight: 300
|
||||
linkTitle: "HTTPEndpoint"
|
||||
description: "The basic spec for a Dapr HTTPEndpoint resource"
|
||||
weight: 4000
|
||||
aliases:
|
||||
- "/operations/httpEndpoints/"
|
||||
---
|
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Resiliency spec"
|
||||
linkTitle: "Resiliency"
|
||||
weight: 3000
|
||||
description: "The basic spec for a Dapr resiliency resource"
|
||||
---
|
||||
|
||||
The `Resiliency` Dapr resource allows you to define and apply fault tolerance resiliency policies. Resiliency specs are applied when the Dapr sidecar starts.
|
||||
|
||||
```yml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Resiliency
|
||||
metadata:
|
||||
name: <REPLACE-WITH-RESOURCE-NAME>
|
||||
version: v1alpha1
|
||||
scopes:
|
||||
- <REPLACE-WITH-SCOPED-APPIDS>
|
||||
spec:
|
||||
policies: # Required
|
||||
timeouts: # Replace with any unique name
|
||||
timeoutName: <REPLACE-WITH-TIME-VALUE>
|
||||
retries:
|
||||
retryName: # Replace with any unique name
|
||||
policy: <REPLACE-WITH-VALUE>
|
||||
duration: <REPLACE-WITH-VALUE>
|
||||
maxInterval: <REPLACE-WITH-VALUE>
|
||||
maxRetries: <REPLACE-WITH-VALUE>
|
||||
circuitBreakers:
|
||||
circuitBreakerName: # Replace with any unique name
|
||||
maxRequests: <REPLACE-WITH-VALUE>
|
||||
timeout: <REPLACE-WITH-VALUE>
|
||||
trip: <REPLACE-WITH-CONSECUTIVE-FAILURE-VALUE>
|
||||
targets: # Required
|
||||
apps:
|
||||
appID: # Replace with scoped app ID
|
||||
timeout: <REPLACE-WITH-TIMEOUT-NAME>
|
||||
retry: <REPLACE-WITH-RETRY-NAME>
|
||||
circuitBreaker: <REPLACE-WITH-CIRCUIT-BREAKER-NAME>
|
||||
actors:
|
||||
myActorType:
|
||||
timeout: <REPLACE-WITH-TIMEOUT-NAME>
|
||||
retry: <REPLACE-WITH-RETRY-NAME>
|
||||
circuitBreaker: <REPLACE-WITH-CIRCUIT-BREAKER-NAME>
|
||||
circuitBreakerCacheSize: <REPLACE-WITH-VALUE>
|
||||
components:
|
||||
componentName: # Replace with your component name
|
||||
outbound:
|
||||
timeout: <REPLACE-WITH-TIMEOUT-NAME>
|
||||
retry: <REPLACE-WITH-RETRY-NAME>
|
||||
circuitBreaker: <REPLACE-WITH-CIRCUIT-BREAKER-NAME>
|
||||
```
|
||||
|
||||
## Spec fields
|
||||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| policies | Y | The configuration of resiliency policies, including: <br><ul><li>`timeouts`</li><li>`retries`</li><li>`circuitBreakers`</li></ul> <br> [See more examples with all of the built-in policies]({{< ref policies.md >}}) | timeout: `general`<br>retry: `retryForever`<br>circuit breaker: `simpleCB` |
|
||||
| targets | Y | The configuration for the applications, actors, or components that use the resiliency policies. <br>[See more examples in the resiliency targets guide]({{< ref targets.md >}}) | `apps` <br>`components`<br>`actors` |
|
||||
|
||||
|
||||
## Related links
|
||||
[Learn more about resiliency policies and targets]({{< ref resiliency-overview.md >}})
|
|
@ -0,0 +1,88 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Subscription spec"
|
||||
linkTitle: "Subscription"
|
||||
weight: 2000
|
||||
description: "The basic spec for a Dapr subscription"
|
||||
---
|
||||
|
||||
The `Subscription` Dapr resource allows you to subscribe declaratively to a topic using an external component YAML file. This guide demonstrates two subscription API versions:
|
||||
|
||||
- `v2alpha` (default spec)
|
||||
- `v1alpha1` (deprecated)
|
||||
|
||||
## `v2alpha1`
|
||||
|
||||
The following is the basic `v2alpha1` spec for a `Subscription` resource. `v2alpha1` is the default spec for the subscription API.
|
||||
|
||||
```yml
|
||||
apiVersion: dapr.io/v2alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: <REPLACE-WITH-NAME>
|
||||
spec:
|
||||
version: v2alpha1
|
||||
topic: <REPLACE-WITH-TOPIC-NAME> # Required
|
||||
routes: # Required
|
||||
- rules:
|
||||
- match: <REPLACE-WITH-EVENT-TYPE>
|
||||
path: <REPLACE-WITH-PATH>
|
||||
pubsubname: <REPLACE-WITH-PUBSUB-NAME> # Required
|
||||
deadlettertopic: <REPLACE-WITH-TOPIC-NAME> # Optional
|
||||
bulksubscribe: # Optional
|
||||
- enabled: <REPLACE-WITH-TOPIC-NAME>
|
||||
- maxmessages: <REPLACE-WITH-TOPIC-NAME>
|
||||
- maxawaitduration: <REPLACE-WITH-TOPIC-NAME>
|
||||
scopes:
|
||||
- <REPLACE-WITH-SCOPED-APPIDS>
|
||||
```
|
||||
|
||||
### Spec fields
|
||||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| topic | Y | The name of the topic to which your component subscribes. | `orders` |
|
||||
| routes | Y | The routes configuration for this topic, including specifying the condition for sending a message to a specific path. Includes the following fields: <br><ul><li>match: _Optional._ The CEL expression used to match the event. If not specified, the route is considered the default. </li><li>path: The path for events that match this rule. </li></ul>The endpoint to which all topic messages are sent. | `match: event.type == "widget"` <br>`path: /widgets` |
|
||||
| pubsubname | N | The name of your pub/sub component. | `pubsub` |
|
||||
| deadlettertopic | N | The name of the dead letter topic that forwards undeliverable messages. | `poisonMessages` |
|
||||
| bulksubscribe | N | Enable bulk subscribe properties. | `true`, `false` |
|
||||
|
||||
|
||||
## `v1alpha1`
|
||||
|
||||
The following is the basic version `v1alpha1` spec for a `Subscription` resource. `v1alpha1` is now deprecated.
|
||||
|
||||
```yml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: <REPLACE-WITH-RESOURCE-NAME>
|
||||
spec:
|
||||
version: v1alpha1
|
||||
topic: <REPLACE-WITH-TOPIC-NAME> # Required
|
||||
route: <REPLACE-WITH-ROUTE-NAME> # Required
|
||||
pubsubname: <REPLACE-WITH-PUBSUB-NAME> # Required
|
||||
deadLetterTopic: <REPLACE-WITH-DEAD-LETTER-TOPIC-NAME> # Optional
|
||||
bulkSubscribe: # Optional
|
||||
- enabled: <REPLACE-WITH-BOOLEAN-VALUE>
|
||||
- maxmessages: <REPLACE-WITH-VALUE>
|
||||
- maxawaitduration: <REPLACE-WITH-VALUE>
|
||||
scopes:
|
||||
- <REPLACE-WITH-SCOPED-APPIDS>
|
||||
```
|
||||
|
||||
### Spec fields
|
||||
|
||||
| Field | Required | Details | Example |
|
||||
|--------------------|:--------:|---------|---------|
|
||||
| topic | Y | The name of the topic to which your component subscribes. | `orders` |
|
||||
| route | Y | The endpoint to which all topic messages are sent. | `/checkout` |
|
||||
| pubsubname | N | The name of your pub/sub component. | `pubsub` |
|
||||
| deadlettertopic | N | The name of the dead letter topic that forwards undeliverable messages. | `poisonMessages` |
|
||||
| bulksubscribe | N | Enable bulk subscribe properties. | `true`, `false` |
|
||||
|
||||
## Related links
|
||||
- [Learn more about the declarative subscription method]({{< ref "subscription-methods.md#declarative-subscriptions" >}})
|
||||
- [Learn more about dead letter topics]({{< ref pubsub-deadletter.md >}})
|
||||
- [Learn more about routing messages]({{< ref "howto-route-messages.md#declarative-subscription" >}})
|
||||
- [Learn more about bulk subscribing]({{< ref pubsub-bulk.md >}})
|
Loading…
Reference in New Issue