diff --git a/daprdocs/content/en/developing-applications/building-blocks/bindings/bindings-overview.md b/daprdocs/content/en/developing-applications/building-blocks/bindings/bindings-overview.md index d82d3d2aa..a2a229425 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/bindings/bindings-overview.md +++ b/daprdocs/content/en/developing-applications/building-blocks/bindings/bindings-overview.md @@ -6,49 +6,56 @@ weight: 100 description: Overview of the bindings API building block --- -## Introduction +Using Dapr's bindings API, you can both trigger your app with events coming in from external systems and interface with external systems. In addition, the Dapr binding API enables you to: -Using bindings, you can trigger your app with events coming in from external systems, or interface with external systems. This building block provides several benefits for you and your code: - -- Remove the complexities of connecting to, and polling from, messaging systems such as queues and message buses -- Focus on business logic and not implementation details of how to interact with a system +- Remove the complexities of connecting to and polling from messaging systems, such as queues and message buses +- Focus on business logic, instead of the implementation details of how to interact with a system - Keep your code free from SDKs or libraries - Handle retries and failure recovery - Switch between bindings at run time -- Build portable applications where environment-specific bindings are set-up and no code changes are required +- Build portable applications with environment-specific bindings set up and no code changes required -For a specific example, bindings would allow your microservice to respond to incoming Twilio/SMS messages without adding or configuring a third-party Twilio SDK, worrying about polling from Twilio (or using websockets, etc.). +For example, with bindings, your microservice can respond to incoming Twilio/SMS messages without: -Bindings are developed independently of Dapr runtime. You can view and contribute to the bindings [here](https://github.com/dapr/components-contrib/tree/master/bindings). +- Adding or configuring a third-party Twilio SDK +- Worrying about polling from Twilio (or using websockets, etc.) + +{{% alert title="Note" color="primary" %}} + Bindings are developed independently of Dapr runtime. You can [view and contribute to the bindings](https://github.com/dapr/components-contrib/tree/master/bindings). + +{{% /alert %}} ## Input bindings -Input bindings are used to trigger your application when an event from an external resource has occurred. -An optional payload and metadata may be sent with the request. +With input bindings, you can trigger your application when an event from an external resource has occurred. An optional payload and metadata may be sent with the request. In order to receive events from an input binding: -1. Define the component YAML that describes the type of binding and its metadata (connection info, etc.) -2. Listen on an HTTP endpoint for the incoming event, or use the gRPC proto library to get incoming events +1. Define the component YAML that describes the type of binding and its metadata (connection info, etc.). +2. Listen on an HTTP endpoint for the incoming event, or use the gRPC proto library to get incoming events. -> On startup Dapr sends a `OPTIONS` request for all defined input bindings to the application and expects a status code other than `NOT FOUND (404)` if this application wants to subscribe to the binding. +{{% alert title="Note" color="primary" %}} + On startup, Dapr sends [an OPTIONS request]({{< ref "bindings_api.md#invoking-service-code-through-input-bindings" >}}) for all defined input bindings to the application and expects a status code 2xx or 405 if this application wants to subscribe to the binding. + +{{% /alert %}} Read the [Create an event-driven app using input bindings]({{< ref howto-triggers.md >}}) page to get started with input bindings. ## Output bindings -Output bindings allow you to invoke external resources. An optional payload and metadata can be sent with the invocation request. +With output bindings, you can invoke external resources. An optional payload and metadata can be sent with the invocation request. In order to invoke an output binding: -1. Define the component YAML that describes the type of binding and its metadata (connection info, etc.) -2. Use the HTTP endpoint or gRPC method to invoke the binding with an optional payload +1. Define the component YAML that describes the type of binding and its metadata (connection info, etc.). +2. Use the HTTP endpoint or gRPC method to invoke the binding with an optional payload. Read the [Use output bindings to interface with external resources]({{< ref howto-bindings.md >}}) page to get started with output bindings. ## Next Steps -* Follow these guides on: - * [How-To: Trigger a service from different resources with input bindings]({{< ref howto-triggers.md >}}) - * [How-To: Use output bindings to interface with external resources]({{< ref howto-bindings.md >}}) -* Try out the [bindings quickstart](https://github.com/dapr/quickstarts/tree/master/tutorials/bindings/README.md) which shows how to bind to a Kafka queue -* Read the [bindings API specification]({{< ref bindings_api.md >}}) + +- Follow these guides on: + - [How-To: Trigger a service from different resources with input bindings]({{< ref howto-triggers.md >}}) + - [How-To: Use output bindings to interface with external resources]({{< ref howto-bindings.md >}}) +- Try out the [bindings tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/bindings/README.md) to experiment with binding to a Kafka queue. +- Read the [bindings API specification]({{< ref bindings_api.md >}}) diff --git a/daprdocs/content/en/developing-applications/building-blocks/configuration/howto-manage-configuration.md b/daprdocs/content/en/developing-applications/building-blocks/configuration/howto-manage-configuration.md index 524d54dfd..d08f0bb44 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/configuration/howto-manage-configuration.md +++ b/daprdocs/content/en/developing-applications/building-blocks/configuration/howto-manage-configuration.md @@ -212,7 +212,40 @@ message SubscribeConfigurationRequest { } ``` -Using this method, you can subscribe to changes in specific keys for a given configuration store. gRPC streaming varies widely based on language. [See the gRPC examples](https://grpc.io/docs/languages/) for usage. +Using this method, you can subscribe to changes in specific keys for a given configuration store. gRPC streaming varies widely based on language - see the [gRPC examples here](https://grpc.io/docs/languages/) for usage. + +Below are the examples in sdks: + +{{< tabs Python>}} + +{{% codetab %}} +```python +#dependencies +import asyncio +from dapr.clients import DaprClient +#code +async def executeConfiguration(): + with DaprClient() as d: + CONFIG_STORE_NAME = 'configstore' + key = 'orderId' + # Subscribe to configuration by key. + configuration = await d.subscribe_configuration(store_name=CONFIG_STORE_NAME, keys=[key], config_metadata={}) + if configuration != None: + items = configuration.get_items() + for item in items: + print(f"Subscribe key={item.key} value={item.value} version={item.version}", flush=True) + else: + print("Nothing yet") +asyncio.run(executeConfiguration()) +``` + +```bash +dapr run --app-id orderprocessing --components-path components/ -- python3 OrderProcessingService.py +``` + +{{% /codetab %}} + +{{< /tabs >}} #### Stop watching configuration items diff --git a/daprdocs/content/en/developing-applications/building-blocks/pubsub/subscription-methods.md b/daprdocs/content/en/developing-applications/building-blocks/pubsub/subscription-methods.md index e34a9dd8a..b963d13da 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/pubsub/subscription-methods.md +++ b/daprdocs/content/en/developing-applications/building-blocks/pubsub/subscription-methods.md @@ -191,15 +191,25 @@ The programmatic approach returns the `routes` JSON structure within the code, u {{% codetab %}} ```csharp -[Topic("pubsub", "checkout", event.type ==\"order\"")] -[HttpPost("orders")] -public async Task> HandleCheckout(Checkout checkout, [FromServices] DaprClient daprClient) +[Topic("pubsub", "orders")] +[HttpPost("/checkout")] +public async Task>Checkout(Order order, [FromServices] DaprClient daprClient) { // Logic - return stock; + return order; } ``` +or + +```csharp +// Dapr subscription in [Topic] routes orders topic to this route +app.MapPost("/checkout", [Topic("pubsub", "orders")] (Order order) => { + Console.WriteLine("Subscriber received : " + order); + return Results.Ok(order); +}); +``` + {{% /codetab %}} {{% codetab %}} diff --git a/daprdocs/content/en/getting-started/quickstarts/pubsub-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/pubsub-quickstart.md index d7e25abbe..86e1fa033 100644 --- a/daprdocs/content/en/getting-started/quickstarts/pubsub-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/pubsub-quickstart.md @@ -508,7 +508,7 @@ For this example, you will need: - [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started). - Java JDK 11 (or greater): - [Oracle JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html#JDK11), or - - [OpenJDK](https://jdk.java.net/13/) + - [OpenJDK](https://jdk.java.net/projects/jdk/13/) - [Apache Maven](https://maven.apache.org/install.html), version 3.x. - [Docker Desktop](https://www.docker.com/products/docker-desktop) diff --git a/daprdocs/content/en/getting-started/quickstarts/secrets-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/secrets-quickstart.md index 89f0da687..fe5067486 100644 --- a/daprdocs/content/en/getting-started/quickstarts/secrets-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/secrets-quickstart.md @@ -352,7 +352,7 @@ For this example, you will need: - [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started). - Java JDK 11 (or greater): - [Oracle JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html#JDK11), or - - [OpenJDK](https://jdk.java.net/13/) + - [OpenJDK](https://jdk.java.net/projects/jdk/13/) - [Apache Maven](https://maven.apache.org/install.html), version 3.x. - [Docker Desktop](https://www.docker.com/products/docker-desktop) diff --git a/daprdocs/content/en/getting-started/quickstarts/serviceinvocation-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/serviceinvocation-quickstart.md index af2066c16..8399a0603 100644 --- a/daprdocs/content/en/getting-started/quickstarts/serviceinvocation-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/serviceinvocation-quickstart.md @@ -388,7 +388,7 @@ For this example, you will need: - [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started). - Java JDK 11 (or greater): - [Oracle JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html#JDK11), or - - [OpenJDK](https://jdk.java.net/13/) + - [OpenJDK](https://jdk.java.net/projects/jdk/13/) - [Apache Maven](https://maven.apache.org/install.html), version 3.x. - [Docker Desktop](https://www.docker.com/products/docker-desktop) diff --git a/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md index b605bf3f0..928390ad4 100644 --- a/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md @@ -386,7 +386,7 @@ For this example, you will need: - [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started). - Java JDK 11 (or greater): - [Oracle JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html#JDK11), or - - [OpenJDK](https://jdk.java.net/13/) + - [OpenJDK](https://jdk.java.net/projects/jdk/13/) - [Apache Maven](https://maven.apache.org/install.html), version 3.x. - [Docker Desktop](https://www.docker.com/products/docker-desktop) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index 1f13c857e..4d9476504 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -99,7 +99,7 @@ OPTIONS http://localhost:/ Code | Description ---- | ----------- 404 | Application does not want to bind to the binding -all others | Application wants to bind to the binding +2xx or 405 | Application wants to bind to the binding #### URL Parameters diff --git a/daprdocs/content/en/reference/components-reference/supported-state-stores/setup-azure-cosmosdb.md b/daprdocs/content/en/reference/components-reference/supported-state-stores/setup-azure-cosmosdb.md index 5595e9677..4542444e5 100644 --- a/daprdocs/content/en/reference/components-reference/supported-state-stores/setup-azure-cosmosdb.md +++ b/daprdocs/content/en/reference/components-reference/supported-state-stores/setup-azure-cosmosdb.md @@ -190,7 +190,7 @@ First, download the code of the stored procedures for the version of Dapr that y ```sh # Set this to the version of Dapr that you're using -DAPR_VERSION="v1.7.0" +DAPR_VERSION="release-{{% dapr-latest-version short="true" %}}" curl -LfO "https://raw.githubusercontent.com/dapr/components-contrib/${DAPR_VERSION}/state/azure/cosmosdb/storedprocedures/__daprver__.js" curl -LfO "https://raw.githubusercontent.com/dapr/components-contrib/${DAPR_VERSION}/state/azure/cosmosdb/storedprocedures/__dapr_v2__.js" ``` diff --git a/daprdocs/layouts/partials/components/description.html b/daprdocs/layouts/partials/components/description.html index 449bcf55a..7cc5a1bf6 100644 --- a/daprdocs/layouts/partials/components/description.html +++ b/daprdocs/layouts/partials/components/description.html @@ -1,16 +1,16 @@

Table captions:

-

Status: Component +

Status: Component certification status

Since: defines from which Dapr Runtime version, the component is in the current status

Component version: defines the version of the component

-
\ No newline at end of file +