eventdbx-client is an async crate that speaks the EventDBX control socket (Cap’n Proto over TCP with a Noise XX handshake derived from your token). It covers list/get/select/events reads plus create/apply/patch/archive mutations.
Feature highlights
- Tokio-native async client; connect once with
EventDbxClient::connectand reuse the socket. - Noise XX (+ PSK from your token) on by default; opt out with
.with_noise(false)when the server permits plaintext. - Serde-friendly JSON payloads/metadata for
create,append,patch, and archive/restore helpers. - Pagination, filters, and sort directives (
created_at,aggregate_id, etc.) onlist_aggregatesandlist_events. - Per-call overrides for publish targets, notes, metadata, and tokens to scope mutations.
- Configurable connect/request timeouts (defaults: 5s connect, 10s request).
Install
Connect and configure
ClientConfig::new(host, token) defaults to port = 6363, tenant = "default", Noise enabled, connect_timeout = 5s, and request_timeout = 10s per RPC. Build one config per tenant/token and reuse the client for the process lifetime. Call .with_request_timeout(None) to disable per-call timeouts.
Runtime configuration
| Variable | Default | Description |
|---|---|---|
EVENTDBX_HOST | 127.0.0.1 | Hostname or IP address of the control socket. |
EVENTDBX_PORT | 6363 | TCP port for the control plane. |
EVENTDBX_TOKEN | empty | Control token forwarded during the handshake. |
EVENTDBX_TENANT | default | Tenant identifier included in the initial hello. |
EVENTDBX_NO_NOISE | false | Set 1/true on the server side to permit plaintext; pair with .with_noise(false). |
ClientConfig as shown above.
Manage authentication and tenancy
Pass the control token and tenant intoClientConfig up front. Per-call token overrides are available on request structs/options (ListAggregatesOptions.token, AppendEventRequest.token, etc.) so you can scope permissions to a user session without rebuilding the client.
Publish targets
Direct mutations to specific plugins and override payload mode/priority per call:publish_targets to fan out to all enabled plugins with their default payload mode. Publish targets are only effective when the named plugins are installed, configured, and running.
Write aggregates and events
create_aggregate seeds a snapshot and first event atomically, append_event appends events, patch_event issues RFC 6902 operations against historical payloads, and set_aggregate_archive toggles write access while preserving history.
Read aggregates and events
next_cursor to resume pagination. verify_aggregate returns the Merkle root for integrity checks.
Filters, sorting, and pagination
Filters use the same SQL-like grammar as the server (field = value AND other_field > 10). Sort directives accept fields like aggregate_id, aggregate_type, created_at, updated_at, and archived. Pass a string ("created_at:desc, aggregate_id:asc") via ListAggregatesOptions.sort_text or build AggregateSort entries. Use include_archived / archived_only when traversing soft-deleted aggregates. Feed next_cursor back into subsequent list_aggregates calls to continue paging.
Noise transport
Noise XX is enabled by default using a PSK derived from your control token. Disable it only for controlled testing with.with_noise(false) and a server configured to honor EVENTDBX_NO_NOISE; production deployments should keep Noise on.
Development & testing
cargo check for quick compilation cycles and cargo fmt --check in CI to keep formatting consistent.