5.3 KiB
Bindings
Dapr provides a mechanism that can either trigger your app with events coming in from external systems, or invoke external systems.
Bindings give you some additional advantages:
- Your code doesn't have to deal with the complexities of connecting to, and polling from, messaging systems such as queues, message buses, etc...
- You can focus on business logic and not the implementation details of how interact with a system
- You can keep your code free from SDKs or libraries
For a specific example, bindings allow your microservice to respond to incoming Twilio/SMS messages without adding/configuring a third-party Twilio SDK, worrying about polling from Twilio (or doing websockets, etc...).
Bindings are developed independently of Dapr runtime. You can view and contribute to the bindings here.
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.
Generic
Name | Input Binding |
Output Binding |
Status |
---|---|---|---|
HTTP | ✅ | Experimental | |
Kafka | ✅ | ✅ | Experimental |
Kubernetes Events | ✅ | Experimental | |
MQTT | ✅ | ✅ | Experimental |
RabbitMQ | ✅ | ✅ | Experimental |
Redis | ✅ | Experimental | |
Twilio | ✅ | Experimental | |
SendGrid | ✅ | Experimental |
Amazon Web Service (AWS)
Name | Input Binding |
Output Binding |
Status |
---|---|---|---|
AWS DynamoDB | ✅ | Experimental | |
AWS S3 | ✅ | Experimental | |
AWS SNS | ✅ | Experimental | |
AWS SQS | ✅ | ✅ | Experimental |
AWS Kinesis | ✅ | ✅ | Experimental |
Google Cloud Platform (GCP)
Name | Input Binding |
Output Binding |
Status |
---|---|---|---|
GCP Cloud Pub/Sub | ✅ | ✅ | Experimental |
GCP Storage Bucket | ✅ | Experimental |
Microsoft Azure
Name | Input Binding |
Output Binding |
Status |
---|---|---|---|
Azure Blob Storage | ✅ | Experimental | |
Azure EventHubs | ✅ | ✅ | Experimental |
Azure CosmosDB | ✅ | Experimental | |
Azure Service Bus Queues | ✅ | ✅ | Experimental |
Azure SignalR | ✅ | Experimental | |
Azure Storage Queues | ✅ | ✅ | Experimental |
Azure Event Grid | ✅ | ✅ | Experimental |
Input bindings
Input bindings are used to trigger your application when an event from an external resource has occurred. An optional payload and metadata might be sent with the request.
In order to receive events from an input binding:
- Define the component YAML that describes the type of binding and its metadata (connection info, etc.)
- 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 different status code asNOT FOUND (404)
if this application wants to subscribe to the binding.
Read the Create an event-driven app using input bindings section to get started with input bindings.
Output bindings
Output bindings allow users to invoke external resources An optional payload and metadata can be sent with the invocation request.
In order to invoke an output binding:
- Define the component YAML that describes the type of binding and its metadata (connection info, etc.)
- Use the HTTP endpoint or gRPC method to invoke the binding with an optional payload
Read the Send events to external systems using Output Bindings section to get started with output bindings.