Merge branch 'v1.7' into bindings_quickstarts

This commit is contained in:
Mark Fussell 2022-06-16 19:54:28 -07:00 committed by GitHub
commit 24919de7ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 22 deletions

View File

@ -12,51 +12,59 @@ Dapr uses a modular design where functionality is delivered as a component. Each
You can get a list of current components available in the hosting environment using the `dapr components` CLI command. You can get a list of current components available in the hosting environment using the `dapr components` CLI command.
## Component specification
Each component has a specification (or spec) that it conforms to. Components are configured at design-time with a YAML file which is stored in either a `components/local` folder within your solution, or globally in the `.dapr` folder created when invoking `dapr init`. These YAML files adhere to the generic [Dapr component schema]({{<ref "component-schema.md">}}), but each is specific to the component specification.
It is important to understand that the component spec values, particularly the spec `metadata`, can change between components of the same component type, for example between different state stores, and that some design-time spec values can be overridden at runtime when making requests to a component's API. As a result, it is strongly recommended to review a [component's specs]({{<ref "components-reference">}}), paying particular attention to the sample payloads for requests to set the metadata used to interact with the component.
## Available component types
The following are the component types provided by Dapr: The following are the component types provided by Dapr:
## State stores ### State stores
State store components are data stores (databases, files, memory) that store key-value pairs as part of the [state management]({{< ref "state-management-overview.md" >}}) building block. State store components are data stores (databases, files, memory) that store key-value pairs as part of the [state management]({{< ref "state-management-overview.md" >}}) building block.
- [List of state stores]({{< ref supported-state-stores >}}) - [List of state stores]({{< ref supported-state-stores >}})
- [State store implementations](https://github.com/dapr/components-contrib/tree/master/state) - [State store implementations](https://github.com/dapr/components-contrib/tree/master/state)
## Name resolution ### Name resolution
Name resolution components are used with the [service invocation]({{<ref "service-invocation-overview.md">}}) building block to integrate with the hosting environment and provide service-to-service discovery. For example, the Kubernetes name resolution component integrates with the Kubernetes DNS service, self-hosted uses mDNS and clusters of VMs can use the Consul name resolution component. Name resolution components are used with the [service invocation]({{<ref "service-invocation-overview.md">}}) building block to integrate with the hosting environment and provide service-to-service discovery. For example, the Kubernetes name resolution component integrates with the Kubernetes DNS service, self-hosted uses mDNS and clusters of VMs can use the Consul name resolution component.
- [List of name resolution components]({{< ref supported-name-resolution >}}) - [List of name resolution components]({{< ref supported-name-resolution >}})
- [Name resolution implementations](https://github.com/dapr/components-contrib/tree/master/nameresolution) - [Name resolution implementations](https://github.com/dapr/components-contrib/tree/master/nameresolution)
## Pub/sub brokers ### Pub/sub brokers
Pub/sub broker components are message brokers that can pass messages to/from services as part of the [publish & subscribe]({{< ref pubsub-overview.md >}}) building block. Pub/sub broker components are message brokers that can pass messages to/from services as part of the [publish & subscribe]({{< ref pubsub-overview.md >}}) building block.
- [List of pub/sub brokers]({{< ref supported-pubsub >}}) - [List of pub/sub brokers]({{< ref supported-pubsub >}})
- [Pub/sub broker implementations](https://github.com/dapr/components-contrib/tree/master/pubsub) - [Pub/sub broker implementations](https://github.com/dapr/components-contrib/tree/master/pubsub)
## Bindings ### Bindings
External resources can connect to Dapr in order to trigger a method on an application or be called from an application as part of the [bindings]({{< ref bindings-overview.md >}}) building block. External resources can connect to Dapr in order to trigger a method on an application or be called from an application as part of the [bindings]({{< ref bindings-overview.md >}}) building block.
- [List of supported bindings]({{< ref supported-bindings >}}) - [List of supported bindings]({{< ref supported-bindings >}})
- [Binding implementations](https://github.com/dapr/components-contrib/tree/master/bindings) - [Binding implementations](https://github.com/dapr/components-contrib/tree/master/bindings)
## Secret stores ### Secret stores
A [secret]({{<ref "secrets-overview.md">}}) is any piece of private information that you want to guard against unwanted access. Secrets stores are used to store secrets that can be retrieved and used in applications. A [secret]({{<ref "secrets-overview.md">}}) is any piece of private information that you want to guard against unwanted access. Secrets stores are used to store secrets that can be retrieved and used in applications.
- [List of supported secret stores]({{< ref supported-secret-stores >}}) - [List of supported secret stores]({{< ref supported-secret-stores >}})
- [Secret store implementations](https://github.com/dapr/components-contrib/tree/master/secretstores) - [Secret store implementations](https://github.com/dapr/components-contrib/tree/master/secretstores)
## Configuration stores ### Configuration stores
Configuration stores are used to save application data, which can then be read by application instances on startup or notified of when changes occur. This allows for dynamic configuration. Configuration stores are used to save application data, which can then be read by application instances on startup or notified of when changes occur. This allows for dynamic configuration.
- [List of supported configuration stores]({{< ref supported-configuration-stores >}}) - [List of supported configuration stores]({{< ref supported-configuration-stores >}})
- [Configuration store implementations](https://github.com/dapr/components-contrib/tree/master/configuration) - [Configuration store implementations](https://github.com/dapr/components-contrib/tree/master/configuration)
## Middleware ### Middleware
Dapr allows custom [middleware]({{<ref "middleware.md">}}) to be plugged into the HTTP request processing pipeline. Middleware can perform additional actions on an HTTP request, such as authentication, encryption and message transformation before the request is routed to the user code, or before the response is returned to the client. The middleware components are used with the [service invocation]({{<ref "service-invocation-overview.md">}}) building block. Dapr allows custom [middleware]({{<ref "middleware.md">}}) to be plugged into the HTTP request processing pipeline. Middleware can perform additional actions on an HTTP request, such as authentication, encryption and message transformation before the request is routed to the user code, or before the response is returned to the client. The middleware components are used with the [service invocation]({{<ref "service-invocation-overview.md">}}) building block.

View File

@ -135,7 +135,7 @@ You can create a trace context using the recommended OpenCensus SDKs. OpenCensus
| Language | SDK | | Language | SDK |
|:-------:|:----:| |:-------:|:----:|
| Go | [Link](https://pkg.go.dev/go.opencensus.io?tab=overview) | Go | [Link](https://pkg.go.dev/go.opencensus.io?tab=overview)
| Java | [Link](https://www.javadoc.io/doc/io.opencensus/opencensus-api/latest/index.html) | Java | [Link](https://github.com/census-instrumentation/opencensus-java)
| C# | [Link](https://github.com/census-instrumentation/opencensus-csharp/) | C# | [Link](https://github.com/census-instrumentation/opencensus-csharp/)
| C++ | [Link](https://github.com/census-instrumentation/opencensus-cpp) | C++ | [Link](https://github.com/census-instrumentation/opencensus-cpp)
| Node.js | [Link](https://github.com/census-instrumentation/opencensus-node) | Node.js | [Link](https://github.com/census-instrumentation/opencensus-node)

View File

@ -210,38 +210,39 @@ dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-g
{{% codetab %}} {{% codetab %}}
```go ```go
//dependencies // dependencies
import ( import (
"context" "context"
"log" "log"
"math/rand" "math/rand"
"time"
"strconv" "strconv"
"time"
dapr "github.com/dapr/go-sdk/client" dapr "github.com/dapr/go-sdk/client"
) )
//code // code
func main() { func main() {
const STATE_STORE_NAME = "statestore"
rand.Seed(time.Now().UnixMicro())
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
time.Sleep(5000)
orderId := rand.Intn(1000-1) + 1 orderId := rand.Intn(1000-1) + 1
client, err := dapr.NewClient() client, err := dapr.NewClient()
STATE_STORE_NAME := "statestore"
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer client.Close() defer client.Close()
ctx := context.Background() ctx := context.Background()
//Using Dapr SDK to save and get state err = client.SaveState(ctx, STATE_STORE_NAME, "order_1", []byte(strconv.Itoa(orderId)), nil)
if err := client.SaveState(ctx, STATE_STORE_NAME, "order_1", []byte(strconv.Itoa(orderId))); err != nil {
panic(err)
}
result, err := client.GetState(ctx, STATE_STORE_NAME, "order_2")
if err != nil { if err != nil {
panic(err) panic(err)
} }
log.Println("Result after get: ") result, err := client.GetState(ctx, STATE_STORE_NAME, "order_1", nil)
log.Println(result) if err != nil {
panic(err)
}
log.Println("Result after get:", string(result.Value))
time.Sleep(2 * time.Second)
} }
} }
``` ```
@ -932,4 +933,4 @@ Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"keys":["
- Read the full [State API reference]({{< ref state_api.md >}}) - Read the full [State API reference]({{< ref state_api.md >}})
- Try one of the [Dapr SDKs]({{< ref sdks >}}) - Try one of the [Dapr SDKs]({{< ref sdks >}})
- Build a [stateful service]({{< ref howto-stateful-service.md >}}) - Build a [stateful service]({{< ref howto-stateful-service.md >}})

View File

@ -482,7 +482,7 @@ cd secrets_management/go/sdk/order-processor
Install the dependencies: Install the dependencies:
```bash ```bash
pip3 install -r requirements.txt go build app.go
``` ```
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.