Skip to content

Commit

Permalink
Merge pull request #3588 from robertojrojas/document-bindings-directi…
Browse files Browse the repository at this point in the history
…on-3541

[Bindings] Documents direction Metadata Field
  • Loading branch information
hhunter-ms authored Jun 29, 2023
2 parents 79f0854 + d6883bb commit 8d445ab
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions daprdocs/content/en/reference/api/bindings_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,45 @@ If running on kubernetes apply the component to your cluster.

> **Note:** In production never place passwords or secrets within Dapr component files. For information on securely storing and retrieving secrets using secret stores refer to [Setup Secret Store]({{< ref setup-secret-store >}})

### Binding direction (optional)

In some scenarios, it would be useful to provide additional information to Dapr to indicate the direction supported by the binding component.
Providing the supported binding direction helps the Dapr sidecar avoid the `"wait for the app to become ready"` state, where it waits indefinitely for the application to become available.

You can specify the `direction` field as part of the component's metadata. The valid values for this field are:
- `"input"`
- `"output"`
- `"input, output"`

Here a few scenarios when the `"direction"` metadata field could help:

- When an application (detached from the sidecar) runs as a serverless workload and is scaled to zero, the `"wait for the app to become ready"` check done by the Dapr sidecar becomes pointless.

- If the detached Dapr sidecar is scaled to zero and the application reaches the sidecar (before even starting an HTTP server), the `"wait for the app to become ready"` deadlocks the app and the sidecar into waiting for each other.

### Example

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: kafkaevent
spec:
type: bindings.kafka
version: v1
metadata:
- name: brokers
value: "http://localhost:5050"
- name: topics
value: "someTopic"
- name: publishTopic
value: "someTopic2"
- name: consumerGroup
value: "group1"
- name: "direction"
value: "input, output"
```

## Invoking Service Code Through Input Bindings

A developer who wants to trigger their app using an input binding can listen on a `POST` http endpoint with the route name being the same as `metadata.name`.
Expand Down

0 comments on commit 8d445ab

Please sign in to comment.