-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Dapr Building Block: Bindings #7960
Comments
👋 @SoTrx Thanks for filing this feature request. A project maintainer will review this feature request and get back to you soon. We also welcome community contributions! If you would like to pick this item up sooner and submit a pull request, please visit our contribution guidelines and assign this to yourself by commenting "/assign" on this issue. For more information on our triage process please visit our triage overview |
👍 We've reviewed this issue and have agreed to add it to our backlog. Please subscribe to this issue for notifications, we'll provide updates when we pick it up. We also welcome community contributions! If you would like to pick this item up sooner and submit a pull request, please visit our contribution guidelines and assign this to yourself by commenting "/assign" on this issue. For more information on our triage process please visit our triage overview |
@SoTrx - Just FYI, we have been working on expanding the built in Radius types with the User defined types solution. This will simplify a lot of writing Go code to make new resource type work in Radius. You can find more context about it in these docs
That said, UDT's feature is still in design and no ETA at the moment. If you have plans to contribute to this now, please go ahead with the current way of adding new types to Radius. |
Changes for usersThis update introduces the Dapr Bindings Building Block.
resource myapp 'Applications.Core/containers@2023-10-01-preview' = {
name: '${baseName}-ctnr'
properties: {
connections: {
mail: {
source: mailing.id
}
cron: {
source: cron.id
}
}
...
}
}
// Output binding to an SMTP server.
// https://docs.dapr.io/reference/components-reference/supported-bindings/smtp/
resource mailing 'Applications.Dapr/bindings@2023-10-01-preview' = {
name: '${baseName}-mail'
properties: {
application: app.id
environment: environment
resourceProvisioning: 'manual'
type: 'bindings.smtp'
metadata: {...}
}
}
// Input binding : a CRON scheduler
// https://docs.dapr.io/reference/components-reference/supported-bindings/cron/
resource cron 'Applications.Dapr/bindings@2023-10-01-preview' = {
name: '${baseName}-cron'
properties: {
application: app.id
environment: environment
resourceProvisioning: 'manual'
type: 'bindings.cron'
metadata: {...}
}
} Using a connection with a import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
)
func sendMail(w http.ResponseWriter, r *http.Request) {
ctx := context.Background()
client, _:= dapr.NewClient()
// Sending an email with the output binding
in := &dapr.InvokeBindingRequest{
Name: CONNECTION_MAIL_COMPONENTNAME,
Operation: "create",
Data: []byte("This is the body of the message"),
Metadata: map[string]string{"emailTo": "example@example.net", "subject": "Not fishy"},
}
out, _:= client.InvokeBinding(ctx, in)
w.WriteHeader(http.StatusOK)
}
func main() {
r := mux.NewRouter()
// Each time a request is received with the input binding
r.HandleFunc(CONNECTION_CRON_COMPONENTNAME, sendMail).Methods("POST", "OPTIONS")
http.ListenAndServe(":6002", r)
} Changes in RadiusThis change adds the resource type Frontendmodel DaprBindingResource
is TrackedResourceRequired<DaprBindingProperties, "DaprBindings"> {
@doc("Binding name")
@key("bindingName")
@path
@segment("bindings")
name: ResourceNameString;
}
@doc("Dapr binding portable resource properties")
model DaprBindingProperties {
...EnvironmentScopedResource;
...DaprResourceProperties;
@doc("A collection of references to resources associated with the binding")
resources?: ResourceReference[];
...RecipeBaseProperties;
} Inner representationtype DaprBinding struct {
v1.BaseResource
// (Properties common to other components)
Properties DaprBindingProperties `json:"properties"`
// ResourceMetadata represents internal DataModel properties common to all portable resource types.
datamodel.PortableResourceMetadata
} Example emitted componentapiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: binding
[labels]
spec:
type: bindings.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: <PASSWORD> Let me know If I need to add anything to this description |
Overview of feature request
The Dapr bindings building block allows interaction with external systems by reacting to external system events through input bindings (e.g., messages received from SaaS software events) or by triggering an external system's response with output bindings (e.g., SMTP, SMS, etc.).
From a component standpoint, the only difference between input and output bindings is the direction metadata.
This enhancement will improve compatibility between Radius and Dapr. The building block is straightforward and won’t require any major changes to the daprrp aside from the new type.
Acceptance criteria
Additional context
https://docs.dapr.io/developing-applications/building-blocks/bindings/bindings-overview/
Would you like to support us?
AB#13234
The text was updated successfully, but these errors were encountered: