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

macro eventstore-macros

Extra EventStoreDB gRPC client internal code generation features

1 unstable release

0.0.1 Feb 13, 2023

#16 in #event-store

Download history 392/week @ 2024-12-04 441/week @ 2024-12-11 277/week @ 2024-12-18 93/week @ 2024-12-25 221/week @ 2025-01-01 440/week @ 2025-01-08 277/week @ 2025-01-15 181/week @ 2025-01-22 544/week @ 2025-01-29 599/week @ 2025-02-05 1037/week @ 2025-02-12 193/week @ 2025-02-19 459/week @ 2025-02-26 534/week @ 2025-03-05 347/week @ 2025-03-12 454/week @ 2025-03-19

1,828 downloads per month
Used in 6 crates (2 directly)

MIT license

5KB
94 lines

KurrentDB Rust Client

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

Documentation

Official Rust KurrentDB rust gRPC gRPC Client.

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

KurrentDB 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 [KurrentDB Docs], follow the docker setup for the simplest configuration.

Example

use kurrentdb::{ 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 KurrentDB
    // 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: [KurrentDB Support]

Documentation

Documentation for KurrentDB can be found here: [KurrentDB 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
~38K SLoC