โ Work in Progress โ
Dapr is a portable, event-driven, serverless runtime for building distributed applications across cloud and edge.
Ensure you have Rust version 1.40 or higher installed. If not, install Rust here.
You will also need to install protoc.
Add the following to your Cargo.toml
file:
[dependencies]
dapr = "0.13.0"
Here's a basic example to create a client:
use dapr;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get the Dapr port and create a connection
let port: u16 = std::env::var("DAPR_GRPC_PORT")?.parse()?;
let addr = format!("https://127.0.0.1:{}", port);
// Create the client
let mut client = dapr::Client::<dapr::client::TonicClient>::connect(addr).await?;
Browse through more examples to understand the SDK better: View examples
To build the SDK run:
cargo build
Note: The protobuf client generation is built into
cargo build
process so updating the proto files underdapr/
is enough to update the protobuf client.
To fetch the latest .proto files from Dapr execute the script update-protos.sh
:
./update-protos.sh
By default, the script fetches the latest proto updates from the master branch of the Dapr repository. If you need to choose a specific release or version, use the -v flag:
./update-protos.sh -v v1.12.0