-
Notifications
You must be signed in to change notification settings - Fork 62
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
How to send/emit cloud events #210
Comments
Hi @oasisk The SDK supports sending events. Is your question how to send an event to an HTTP endpoint? Are you looking for a browser-based solution (so with a WebAssembly)? |
@Lazzaretti ..yes..want to understand how do we send events to http end point? |
This thread is very old, and I presume moot, but here is a simple example: // [dependencies]
// cloudevents-sdk = {version = "0.7", features = ["reqwest"]}
// reqwest = "0.11"
// tokio = {version = "1.41", features = ["rt-multi-thread", "macros"]}
use cloudevents::{binding::reqwest::RequestBuilderExt, Data, EventBuilder, EventBuilderV10};
#[tokio::main]
async fn main() {
let ce = EventBuilderV10::new()
.id("id-1")
.source("source")
.ty("type")
.data("text/plain", Data::String("data".to_owned()))
.build()
.unwrap();
let url = "https://httpbin.org/post";
reqwest::Client::new()
.post(url)
.event(ce)
.unwrap()
.send()
.await
.unwrap();
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javascript sdk supports sending events , how to send events using rust sdk.
https://github.com/cloudevents/sdk-javascript#emitting-events
The text was updated successfully, but these errors were encountered: