add binding concepts and specs (#14)

* add binding concepts and specs

* Performed edits on the doc

We need to be clear between saying binding are used to trigger events from external systems or external resources and then stick with this. Hence getting the terminology section written soon, would be best.
This commit is contained in:
Yaron Schneider 2019-09-27 15:12:01 -07:00 committed by GitHub
parent 615648c86c
commit b2237d001a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 368 additions and 2 deletions

View File

@ -1,3 +1,57 @@
# documentation
# Bindings
Content for this file to be added
Using bindings, you can trigger your app with events coming in from external systems, or invoke external systems.
Bindings allow for on-demand, event-driven compute scenarios, and dapr bindings help developers with the following:
* Remove the complexities of connecting to, and polling from, messaging systems such as queues, message buses etc
* Focus on business logic and not the implementation details of how interact with a system.
* Keep the code free from SDKs or libraries
* Handles retries and failure recovery
* Switch between bindings at runtime time
* Enable portable applications where environment-specific bindings are set-up and no code changes are required
Bindings are developed independently of dapr runtime. You can view and contribute to the bindings [here](https://github.com/actionscore/components-contrib/tree/master/bindings).
## Supported Bindings and Specs
Every binding has its own unique set of properties. Click the name link to see the component YAML for each binding.
| Name | Input Binding | Output Binding | Status
| ------------- | -------------- | ------------- | ------------- |
| [Kafka](./specs/kafka.md) | V | V | Experimental |
| [RabbitMQ](./specs/rabbitmq.md) | V | V | Experimental |
| [AWS SQS](./specs/sqs.md) | V | V | Experimental |
| [AWS SNS](./specs/sns.md) | | V | Experimental |
| [Azure EventHubs](./specs/eventhubs.md) | V | V | Experimental |
| [Azure CosmosDB](./specs/cosmosdb.md) | V | | Experimental |
| [GCP Storage Bucket](./specs/gcpbucket.md) | | V | Experimental |
| [HTTP](./specs/http.md) | | V | Experimental |
| [MQTT](./specs/mqtt.md) | V | V | Experimental |
| [Redis](./specs/redis.md) | | V | Experimental |
| [AWS DynamoDB](./specs/dynamodb.md) | | V | Experimental |
| [AWS S3](./specs/s3.md) | | V | Experimental |
| [Azure Blob Storage](./specs/blobstorage.md) | | V | Experimental |
## Input Bindings
Input bindings are used to trigger your app when an event from an external system has occured.
An optional payload and metadata might be sent with the request.
In order to receive events from an input binding:
1. Define the component YAML that describes the type of bindings 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.
Read the [How To](../../howto) section to get started with input bindings.
## Output Bindings
Output bindings allow users to invoke external systems
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 bindings and its metadata (connection info, etc.)
2. Use the HTTP endpoint or gRPC method to invoke the binding with an optional payload
Read the [How To](../../howto) section to get started with output bindings.

View File

@ -0,0 +1,21 @@
# Azure Blob Storage Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.azure.blobstorage
metadata:
- name: storageAccount
value: https://******.documents.azure.com:443/
- name: storageAccessKey
value: ***********
- name: container
value: container1
```
`storageAccount` is the Blob Storage account name.
`storageAccessKey` is the Blob Storage access key.
`container` is the name of the Blob Storage container to write to.

View File

@ -0,0 +1,27 @@
# Azure CosmosDB Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.azure.cosmosdb
metadata:
- name: url
value: https://******.documents.azure.com:443/
- name: masterKey
value: *****
- name: database
value: db
- name: collection
value: collection
- name: partitionKey
value: message
```
`url` is the CosmosDB url.
`masterKey` is the CosmosDB account master key.
`database` is the name of the CosmosDB database.
`collection` is name of the collection inside the database.
`partitionKey` is the name of the partitionKey to extract from the payload.

View File

@ -0,0 +1,24 @@
# AWS DynamoDB Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.aws.dynamodb
metadata:
- name: region
value: us-west-2
- name: accessKey
value: *****************
- name: secretKey
value: *****************
- name: table
value: items
```
`region` is the AWS region.
`accessKey` is the AWS access key.
`secretKey` is the AWS secret key.
`table` is the DynamoDB table name.

View File

@ -0,0 +1,21 @@
# Azure EventHubs Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.azure.eventhubs
metadata:
- name: connectionString
value: https://<address>
- name: consumerGroup # Optional
value: group1
- name: messageAge
value: 5s # Optional. Golang duration
```
`connectionString` is the EventHubs connection string.
`consumerGroup` is the name of an EventHubs consumerGroup to listen on.
`messageAge` allows to receive messages that are not older than the specified age.

View File

@ -0,0 +1,45 @@
# GCP Storage Bucket Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.gcp.storage
metadata:
- name: bucket
value: mybucket
- name: type
value: service_account
- name: project_id
value: project_111
- name: private_key_id
value: *************
- name: client_email
value: name@domain.com
- name: client_id
value: '1111111111111111'
- name: auth_uri
value: https://accounts.google.com/o/oauth2/auth
- name: token_uri
value: https://oauth2.googleapis.com/token
- name: auth_provider_x509_cert_url
value: https://www.googleapis.com/oauth2/v1/certs
- name: client_x509_cert_url
value: https://www.googleapis.com/robot/v1/metadata/x509/<project-name>.iam.gserviceaccount.com
- name: private_key
value: PRIVATE KEY
```
`bucket` is the bucket name.
`type` is the GCP credentials type.
`project_id` is the GCP project id.
`private_key_id` is the GCP private key id.
`client_email` is the GCP client email.
`client_id` is the GCP client id.
`auth_uri` is Google account oauth endpoint.
`token_uri` is Google account token uri.
`auth_provider_x509_cert_url` is the GCP credentials cert url.
`client_x509_cert_url` is the GCP credentials project x509 cert url.
`private_key` is the GCP credentials private key.

View File

@ -0,0 +1,18 @@
# HTTP Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.http
metadata:
- name: url
value: http://something.com
- name: method
value: GET
```
`url` is the HTTP url to invoke.
`method` is the HTTP verb to use for the request.

View File

@ -0,0 +1,24 @@
# Kafka Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.kafka
metadata:
- name: topics # Optional. in use for input bindings
value: topic1,topic2
- name: brokers
value: localhost:9092,localhost:9093
- name: consumerGroup
value: group1
- name: publishTopic # Optional. in use for output bindings
value: topic3
```
`topics` is a comma separated string of topics for an input binding.
`brokers` is a comma separated string of kafka brokers.
`consumerGroup` is a kafka consumer group to listen on.
`publishTopic` is the topic to publish for an output binding.

View File

@ -0,0 +1,18 @@
# MQTT Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.mqtt
metadata:
- name: url
value: mqtt[s]://[username][:password]@host.domain[:port]
- name: topic
value: topic1
```
`url` is the MQTT broker url.
`topic` is the topic to listen on or send events to.

View File

@ -0,0 +1,24 @@
# RabbitMQ Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.rabbitmq
metadata:
- name: queueName
value: queue1
- name: host
value: amqp://guest:guest@localhost:5672
- name: durable
value: true
- name: deleteWhenUnused
value: false
```
`queueName` is the RabbitMQ queue name.
`host` is the RabbitMQ host address.
`durable` tells RabbitMQ to persist message in storage.
`deleteWhenUnused` enables or disables auto-delete.

View File

@ -0,0 +1,18 @@
# Redis Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.redis
metadata:
- name: redisHost
value: <address>:6379
- name: redisPassword
value: **************
```
`redisHost` is the Redis host address.
`redisPassword` is the Redis password.

View File

@ -0,0 +1,24 @@
# AWS S3 Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.aws.s3
metadata:
- name: region
value: us-west-2
- name: accessKey
value: *****************
- name: secretKey
value: *****************
- name: bucket
value: mybucket
```
`region` is the AWS region.
`accessKey` is the AWS access key.
`secretKey` is the AWS secret key.
`table` is the name of the S3 bucket to write to.

View File

@ -0,0 +1,24 @@
# AWS SNS Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.aws.sns
metadata:
- name: region
value: us-west-2
- name: accessKey
value: *****************
- name: secretKey
value: *****************
- name: topicArn
value: mytopic
```
`region` is the AWS region.
`accessKey` is the AWS access key.
`secretKey` is the AWS secret key.
`topicArn` is the SNS topic name.

View File

@ -0,0 +1,24 @@
# AWS SQS Binding Spec
```
apiVersion: actions.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: bindings.aws.sqs
metadata:
- name: region
value: us-west-2
- name: accessKey
value: *****************
- name: secretKey
value: *****************
- name: queueName
value: items
```
`region` is the AWS region.
`accessKey` is the AWS access key.
`secretKey` is the AWS secret key.
`queueName` is the SQS queue name.