eventstore-rs
eventstore-rs copied to clipboard
Rust GetEventStore TCP Client
REPO HAS MOVED!
This client is now officiallly supported by EventStore Ltd. The code is now hosted here: https://github.com/EventStore/EventStoreDB-Client-Rust
eventstore-rs
Rust EventStore TCP Client.
Talk and exchange ideas in our dedicated Discord Server
State of implemented features
- [x] Can connect to GetEventStore >=4.* servers (for version 20.6 and above enable the
es6feature flag and use thees6module). - [x] Connection health tracking.
- [x] Operation timeout detection and retry.
- [x] Write events.
- [x] Read events (including
$allstream). - [x] Read/Write stream metadata.
- [x] Transactions.
- [x] Delete stream.
- [x] Volatile Subscriptions.
- [x] Catchup Subscriptions.
- [x] Persistent Subscriptions.
- [x] Support connection to server clusters. (through gossip seeds or DNS)
- [x] Support SSL connection.
Example
#[macro_use]
extern crate serde_json;
use eventstore::{ Connection, EventData };
use futures::Future;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "127.0.0.1:1113".parse()?;
let connection = Connection::builder()
.single_node_connection(addr)
.await;
// It is not mandatory to use JSON as a data format however GetEventStore
// provides great additional value if you do so.
let payload = json!({
"is_rust_a_nice_language": true,
});
let event = EventData::json("language-poll", payload)?;
let result = connection
.write_events("language-stream")
.push_event(event)
.execute()
.await?;
// Do something productive with the result.
println!("{:?}", result);
Ok(())
}
Notes
That library was tested on Linux and OSX.
Contributions and bug reports are welcome!
MIT License