Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

KurrentDB Java Client

License

NotificationsYou must be signed in to change notification settings

kurrent-io/KurrentDB-Client-Java

Repository files navigation

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

This repository contains anEventStoreDB Client SDK written in Java for use with languages on the JVM. It iscompatible with Java 8 and above.

Note: This client is currently under active development and further API changes are expected. Feedback is very welcome.

Documentation

Access to binaries

EventStore Ltd publishes GA (general availability) versions toMaven Central.

Snapshot versions

Snapshot versions are pushed on Sonatype Snapshots Repository every time a pull request is merged in the main branchtrunk.The snippet below shows how to use the Sonatype Snapshots Repository using the Gradle build tool.

repositories {...    maven {        url uri('https://oss.sonatype.org/content/repositories/snapshots')    }...}

Developing

The SDK is built usingGradle. Integration tests run against a server using Docker, with theEventStoreDB gRPCClient Test Container.

Run tests

Tests are written usingTestContainers and requireDocker to be installed.

Specific docker images can be specified via the enviroment variableEVENTSTORE_IMAGE.

Open Telemetry

Tracing is the only telemetry currently exported, specifically for theAppend andSubscribe (Catchup and Persistent) operations.

For more information about Open Telemetry, refer to theofficial documentation.

EventStoreDB Server Compatibility

This client is compatible with version20.6.1 upwards.

Server setup instructions can be found in thedocs, follow the docker setup for the simplest configuration.

Example

The following snippet showcases a simple example where we form a connection, then write and read events from the server.

Note: If testing locally using--insecure the url should beesdb://localhost:2113?tls=false.

classAccountCreated {privateUUIDid;privateStringlogin;publicUUIDgetId() {returnid;    }publicStringgetLogin() {returnlogin;    }publicvoidsetId(UUIDid) {this.id =id;    }publicvoidsetLogin(Stringlogin) {this.login =login;    }}
importcom.eventstore.dbclient.EventStoreDBClient;importcom.eventstore.dbclient.EventStoreDBClientSettings;importcom.eventstore.dbclient.EventStoreDBConnectionString;importcom.eventstore.dbclient.EventData;importcom.eventstore.dbclient.ReadStreamOptions;importcom.eventstore.dbclient.ResolvedEvent;importcom.eventstore.dbclient.WriteResult;importcom.eventstore.dbclient.ReadResult;publicclassMain {publicstaticvoidmain(Stringargs[]) {EventStoreDBClientSettingssetts =EventStoreDBConnectionString.parseOrThrow("esdb://localhost:2113");EventStoreDBClientclient =EventStoreDBClient.create(setts);AccountCreatedcreatedEvent =newAccountCreated();createdEvent.setId(UUID.randomUUID());createdEvent.setLogin("ouros");EventDataevent =EventData                .builderAsJson("account-created",createdEvent)                .build();WriteResultwriteResult =client                .appendToStream("accounts",event)                .get();ReadStreamOptionsreadStreamOptions =ReadStreamOptions.get()                .fromStart()                .notResolveLinkTos();ReadResultreadResult =client                .readStream("accounts",1,readStreamOptions)                .get();ResolvedEventresolvedEvent =readResult                .getEvents()                .get(0);AccountCreatedwrittenEvent =resolvedEvent.getOriginalEvent()                .getEventDataAs(AccountCreated.class);// Doing something productive...    }}

Projections

This client currently supports creating and getting the result of a continuous projection.

Create a projection:

EventStoreDbClientSettingssetts =EventStoreDBConnectionString.parseOrThrow("esdb://localhost:2113");EventStoreDBProjectionManagementClientclient =EventStoreDBProjectionManagementClient.create(setts);client    .createContinuous(PROJECTION_NAME,PROJECTION_JS)    .get();

Define a class in which to deserialize the result:

publicclassCountResult {privateintcount;publicintgetCount() {returncount;    }publicvoidsetCount(finalintcount) {this.count =count;    }}

Get the result:

CountResultresult =client    .getResult(PROJECTION_NAME,CountResult.class)    .get();

For further details please seethe projection management tests.

Support

Information on support can be found on our website:Event Store Support

Documentation

Documentation for EventStoreDB can be found in thedocs.

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

Security

If you find a vulnerability in our software, please contact us. You can find how to reach out us and report it athttps://www.eventstore.com/security#securityThank you very much for supporting our software.

Communities

Contributing

All contributions to the SDK are made via GitHub Pull Requests, and must be licensed under the Apache 2.0 license. Pleasereview ourContributing Guide andCode of Conduct for more information.


[8]ページ先頭

©2009-2025 Movatter.jp