#event-store #grpc-client #grpc #event-sourcing #eventstoredb

macro eventstore-macros

Extra EventStoreDB gRPC client internal code generation features

1 unstable release

0.0.1 Feb 13, 2023

#39 in #event-store

Download history 396/week @ 2024-04-15 338/week @ 2024-04-22 141/week @ 2024-04-29 397/week @ 2024-05-06 526/week @ 2024-05-13 234/week @ 2024-05-20 311/week @ 2024-05-27 325/week @ 2024-06-03 525/week @ 2024-06-10 517/week @ 2024-06-17 286/week @ 2024-06-24 473/week @ 2024-07-01 432/week @ 2024-07-08 465/week @ 2024-07-15 439/week @ 2024-07-22 342/week @ 2024-07-29

1,681 downloads per month
Used in 3 crates (via eventstore)

MIT license

5KB
94 lines

EventStoreDB Rust Client

Crates.io Crates.io Build Status Discord Crates.io

Documentation

Official Rust EventStoreDB rust gRPC gRPC Client.

EventStoreDB is the event-native database, where business events are immutably stored and streamed. Designed for event-sourced, event-driven, and microservices architectures.

EventStoreDB Server Compatibility

This client is compatible with version 20.6.1 upwards and works on Linux, MacOS and Windows.

Server setup instructions can be found here EventStoreDB Docs, follow the docker setup for the simplest configuration.

Example

use eventstore::{ Client, EventData };
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct Foo {
    is_rust_a_nice_language: bool,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    // Creates a client settings for a single node configuration.
    let settings = "esdb://admin:changeit@localhost:2113".parse()?;
    let client = Client::new(settings)?;

    let payload = Foo {
        is_rust_a_nice_language: true,
    };

    // It is not mandatory to use JSON as a data format however EventStoreDB
    // provides great additional value if you do so.
    let evt = EventData::json("language-poll", &payload)?;

    client
        .append_to_stream("language-stream", &Default::default(), evt)
        .await?;

    let mut stream = client
        .read_stream("language-stream", &Default::default())
        .await?;

    while let Some(event) = stream.next().await? {
        let event = event.get_original_event()
          .as_json::<Foo>()?;

        // Do something productive with the result.
        println!("{:?}", event);
    }

    Ok(())
}

Support

Information on support can be found here: EventStoreDB Support

Documentation

Documentation for EventStoreDB can be found here: EventStoreDB Docs

Bear in mind that this client is not yet properly documented. We are working hard on a new version of the documentation.

Communities

Dependencies

~1.5MB
~35K SLoC