components-contrib/bindings
Wang Bing db99b43068
Use revive instead of golint (#1685)
Signed-off-by: pigletfly <wangbing.adam@gmail.com>

Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
2022-05-06 12:55:17 -07:00
..
alicloud Add context in bindings interface 2022-04-25 14:16:15 +08:00
apns Add context in bindings interface 2022-04-25 14:16:15 +08:00
aws Add context in bindings interface 2022-04-25 14:16:15 +08:00
azure Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
commercetools Add context in bindings interface 2022-04-25 14:16:15 +08:00
cron Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
gcp Add context in bindings interface 2022-04-25 14:16:15 +08:00
graphql Add context in bindings interface 2022-04-25 14:16:15 +08:00
http Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
influx Add context in bindings interface 2022-04-25 14:16:15 +08:00
kafka Add context in bindings interface 2022-04-25 14:16:15 +08:00
kubernetes Add context in bindings interface 2022-04-25 14:16:15 +08:00
localstorage Add context in bindings interface 2022-04-25 14:16:15 +08:00
mqtt Add context in bindings interface 2022-04-25 14:16:15 +08:00
mysql Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
postgres Add context in bindings interface 2022-04-25 14:16:15 +08:00
postmark Add context in bindings interface 2022-04-25 14:16:15 +08:00
rabbitmq Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
redis Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
rethinkdb/statechange Add context in bindings interface 2022-04-25 14:16:15 +08:00
smtp Add context in bindings interface 2022-04-25 14:16:15 +08:00
twilio Add context in bindings interface 2022-04-25 14:16:15 +08:00
twitter Add context in bindings interface 2022-04-25 14:16:15 +08:00
zeebe Use revive instead of golint (#1685) 2022-05-06 12:55:17 -07:00
Readme.md Update readme of bindings (#1690) 2022-04-28 13:51:58 -07:00
input_binding.go Add context in bindings interface 2022-04-25 14:16:15 +08:00
metadata.go update license to Apache v2.0 (#1406) 2022-01-04 19:53:31 -08:00
output_binding.go Add context in bindings interface 2022-04-25 14:16:15 +08:00
requests.go update license to Apache v2.0 (#1406) 2022-01-04 19:53:31 -08:00
responses.go Added ContentType to pubsub/binding/state request-response (#1376) 2022-01-28 10:17:04 -08:00

Readme.md

Bindings

Bindings provide a common way to trigger an application with events from external systems, or invoke an external system with optional data payloads. Bindings are great for event-driven, on-demand compute and help reduce boilerplate code.

To get started with bindings visit the How To Guide.

To view all the currently supported bindings visit: Dapr bindings.

For detailed binding specs visit Dapr binding specs.

Implementing a new binding

A compliant binding needs to implement one or more interfaces, depending on the type of binding (Input or Output):

Input binding:

type InputBinding interface {
	Init(metadata Metadata) error
	Read(handler func(context.Context, *ReadResponse) ([]byte, error)) error
}

Output binding:

An output binding can be used to invoke an external system and also to return data from it. Each output binding can decide which operations it supports. This information is communicated to the caller via the Operations() method.

type OutputBinding interface {
	Init(metadata Metadata) error
	Invoke(ctx context.Context, req *InvokeRequest) (*InvokeResponse, error)
	Operations() []OperationKind
}

When creating an Output Binding, a list of OperationKind items needs to be returned. For example, if running a component that takes in a SQL query and returns a result set, the OperationKind can be query.

While components are not restricted to a list of supported operations, it's best to use common ones if the operation kind falls under that operation definition. The list of common operations can be found here.

After implementing a binding, the specification docs need to be updated via a PR: Dapr docs.