bindings

package
v0.0.0-...-dfea14c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 1 Imported by: 0

README

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.

List of bindings and their status:

Name Input Binding Output Binding Status
Kafka V V Experimental
RabbitMQ V V Experimental
AWS SQS V V Experimental
AWS SNS V Experimental
GCP Cloud Pub/Sub V V Experimental
Azure EventHubs V V Experimental
Azure CosmosDB V Experimental
GCP Storage Bucket V Experimental
HTTP V Experimental
MQTT V V Experimental
Redis V Experimental
AWS DynamoDB V Experimental
AWS S3 V Experimental
Azure Blob Storage V Experimental
Azure Service Bus Queues V V Experimental
Kubernetes Events V Experimental

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(*ReadResponse) error) error
}

Output binding:

type OutputBinding interface {
	Init(metadata Metadata) error
	Write(req *WriteRequest) error
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppResponse

type AppResponse struct {
	Data        interface{}        `json:"data"`
	To          []string           `json:"to"`
	State       []state.SetRequest `json:"state"`
	Concurrency string             `json:"concurrency"`
}

AppResponse is the object describing the response from user code after a bindings event

type InputBinding

type InputBinding interface {
	// Init passes connection and properties metadata to the binding implementation
	Init(metadata Metadata) error
	// Read is a blocking method that triggers the callback function whenever an event arrives
	Read(handler func(*ReadResponse) error) error
}

InputBinding is the interface to define a binding that triggers on incoming events

type Metadata

type Metadata struct {
	Name       string
	Properties map[string]string `json:"properties"`
}

Metadata represents a set of binding specific properties

type OutputBinding

type OutputBinding interface {
	Init(metadata Metadata) error
	Write(req *WriteRequest) error
}

OutputBinding is the interface for an output binding, allowing users to invoke remote systems with optional payloads

type ReadResponse

type ReadResponse struct {
	Data     []byte            `json:"data"`
	Metadata map[string]string `json:"metadata"`
}

ReadResponse is an the return object from an dapr input binding

type WriteRequest

type WriteRequest struct {
	Data     []byte            `json:"data"`
	Metadata map[string]string `json:"metadata"`
}

WriteRequest is the object given to an dapr output binding

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL