Crate ksqldb[−][src]
KSQL DB
This crate is a thin wrapper around the KSQL-DB REST API to make interacting with the API more ergonomic for Rust projects. Under the hood it uses reqwest as a HTTP client to interact with the API.
Quickstart
use reqwest::Client; use ksqldb::KsqlDB; use futures_util::stream::StreamExt; use serde::Deserialize; #[derive(Debug, Deserialize)] struct MyResponse { id: String, data: Vec<u32> } #[tokio::main] async fn main() { let ksql = KsqlDB::new("localhost:8080".into(), Client::builder(), false).unwrap(); let statement = r#"SHOW STREAMS EXTENDED;"#; let response = ksql.list_streams(&statement, Default::default(), None).await.unwrap(); println!("{:#?}", response); let query = r#"SELECT * FROM MY_STREAM EMIT CHANGES;"#; let mut stream = ksql.select::<MyResponse>(&query, Default::default()).await.unwrap(); while let Some(data) = stream.next().await { println!("{:#?}", data); } }
Modules
types | Common return types from KSQL DB |
Structs
KsqlDB | A KSQL-DB Client, ready to make requests to the server |
Enums
Error | The error type for this library, it includes the wrapping of errors returned from KSQL DB |
Type Definitions
Result | The result type for this library |