Crates.io | ksqldb |
lib.rs | ksqldb |
version | 0.1.0-alpha.6 |
source | src |
created_at | 2021-02-19 16:11:10.594768 |
updated_at | 2021-02-24 12:56:19.142335 |
description | A thin wrapper around the KSQL DB REST API to make it more ergonomic to work with. |
homepage | |
repository | https://github.com/naamancurtis/ksql-db-rs |
max_upload_size | |
id | 357642 |
size | 49,872 |
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.
This project is very much in the early stage and a WIP, so if there are any features or improvements you would like made to it, please raise an issue. Similarly all contributions are welcome.
Up until the point of a v0.2 release the project will not follow semver. Ie.
subsequent v0.1-alpha
or v0.1-beta
releases might include breaking changes,
this is to give the library the freedom to improve the API design quickly while
still in it's early stages. Once v0.2 is released the project will follow
semver.
futures::Stream
are already created for youuse 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);
}
}
STABLE
release of Rust