How-To: Use output bindings to interface with external resources
Output bindings enable you to invoke external resources without taking dependencies on special SDK or libraries. For a complete sample showing output bindings, visit this link.
Watch this on how to use bi-directional output bindings.
An output binding represents a resource that Dapr uses to invoke and send messages to.
Create a new binding component with the name of .
Inside the metadata
section, configure Kafka related properties such as the topic to publish the message to and the broker.
Create the following YAML file, named binding.yaml
, and save this to a components
sub-folder in your application directory. (Use the flag with dapr run
to point to your custom components dir)
All that’s left now is to invoke the output bindings endpoint on a running Dapr instance.
You can do so using HTTP:
As seen above, you invoked the /binding
endpoint with the name of the binding to invoke, in our case its myevent
. The payload goes inside the mandatory data
field, and can be any JSON serializable value.