Skip to main content
The Java SDK targets Java 17+ and mirrors the Node.js control client. It opens a persistent TCP connection to the EventDBX control socket, negotiates Noise + Cap’n Proto frames, and exposes blocking APIs for aggregate mutations, queries, and pagination. Defaults read from EVENTDBX_* environment variables so you can drop it into Spring, Micronaut, Quarkus, or standalone JVM services.

Feature highlights

  • Blocking control-socket client with parity to eventdbxjs (create, apply, patch, archive / restore, list, events, get, select).
  • Noise XX (+ PSK) transport enabled by default; opt into plaintext with noNoise / EVENTDBX_NO_NOISE when the server allows it.
  • Publish target routing per mutation via PublishTarget.of(...) or publishTarget("plugin:mode:priority").
  • Retry/backoff, connect/request timeouts, and env-driven defaults for host, port, token, tenant, and verbosity.
  • JSON payloads/metadata handled with Jackson JsonNode so you can work with strongly typed DTOs or raw trees.

Install

Maven

Gradle (Kotlin DSL)

The Noise handshake depends on the native snownoise library in this repo (native/snownoise). Run cargo build --release --manifest-path native/snownoise/Cargo.toml and ensure the built library is on java.library.path (or set SNOWNOISE_LIB / SNOWNOISE_LIB_PATH) before connecting. Artifacts are published to Maven Central: https://central.sonatype.com/artifact/com.eventdbx/eventdbx-java

Quickstart

EventDbxClient is AutoCloseable, and defaults will pull host/port/token/tenant from the environment. Per-call token overrides let you scope mutations to a request without rebuilding the client.

Publish targets

Omit publish targets to fan out to every enabled plugin. String specs follow plugin:mode:priority (mode/priority optional).

Write aggregates and events

create seeds a snapshot and first event atomically, apply appends events, patch issues RFC 6902 operations against historical payloads, and archive/restore toggle write access while preserving history.

Read aggregates and events

Use Page.nextCursor() to resume pagination, and token on PageOptions, AppendOptions, CreateAggregateOptions, or PatchOptions to scope a call without rebuilding the client.

Retry and timeouts

  • RetryPolicy controls exponential backoff (maxAttempts, initialDelay, maxDelay); defaults to a single attempt.
  • connectTimeout and requestTimeout live on EventDbxConfig and default to 3s / 10s respectively.
  • client.isConnected() and client.disconnect() help when hot reloading or orchestrating graceful shutdowns.

Runtime configuration

Noise transport

Noise is enabled by default with a PSK derived from the control token. Only disable it for controlled testing by passing noNoise(true) on EventDbxConfig or setting EVENTDBX_NO_NOISE=1; production deployments should keep Noise on. You can also override the handshake pattern with EVENTDBX_NOISE_PATTERN when experimenting with other Noise variants.

Development & testing

Run the native build once per platform so the Noise handshake can load its bindings, then execute the Maven tests or package tasks as usual.