We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Include a section to invoke a HTTP service.
reqwest = "0.12.9" dapr = "0.15.1" tokio = "1.41.1"
After several optimizations, my Cargo.toml file is this way and it is running:
Cargo.toml
reqwest = { version = "0.12.9", default-features = false } dapr = "0.15.1" tokio = "1.41.1"
This example uses:
tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() .block_on(async { let client_result = dapr::Client::<dapr::client::TonicClient>::connect(format!("{}", ADDR)).await; let method_to_call = format!("<method-name-to-invoke>/{}", value); match client_result { Ok(mut client) => { // Create a new HTTP client let client = reqwest::Client::builder() .timeout(Duration::from_secs(2)) // the value what you need .build() .unwrap(); // Post the method // ADDR = "127.0.0.1" // PORT = <app-port-to-invoke> let url = format!("{}:{}/{}", ADDR, PORT, method_to_call); let req = client.post(url).header("dapr-app-id", "<app-id-to-invoke>"); let response_result = req.send().await; match response_result { Ok(response) => { let body_result = response.text().await; match body_result { Ok(body) => { println!("Response: {:?}", body); }, Err(e) => { eprintln!("e1: {}", e); } } }, Err(e) => { eprintln!("e2: {}", e); } } }, Err(e) => { eprintln!("Dapr client error: {}", e); } } });
RELEASE NOTE: ADD New example to invoke to a HTTP service in the Rust SDK.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the feature/proposal
Include a section to invoke a HTTP service.
Sample code
Cargo.toml
After several optimizations, my
Cargo.toml
file is this way and it is running:Rust code
This example uses:
Release Note
RELEASE NOTE: ADD New example to invoke to a HTTP service in the Rust SDK.
The text was updated successfully, but these errors were encountered: