GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MateuszNaKodach/EventStoreDB-Client-Java: Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

157 Commits
157 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
db-client-java
db-client-java
 
 
gradle/wrapper
gradle/wrapper
 
 
.git.commit.template
.git.commit.template
 
 
.gitignore
.gitignore
 
 
CODE-OF-CONDUCT.md
CODE-OF-CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

EventStoreDB Client SDK for Java

This repository contains an EventStoreDB Client SDK written in Java for use with languages on the JVM. It is compatible with Java 8 and above.

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

Access to binaries

EventStore Ltd publishes GA (general availability) versions to Maven Central.

Snapshot versions

Snapshot versions are pushed on Sonatype Snapshots Repository every time a pull request is merged in the main branch trunk. 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 using Gradle. Integration tests run against a server using Docker, with the EventStoreDB gRPC Client Test Container.

Run tests

Tests are written using TestContainers and require Docker to be installed. To access the github packages docker images, you need to authenticate docker with a gitub personal access token. It should be generated. Select at least following scopes:

  • repo
  • read:packages
  • write:packages

Then login to github docker registry with:

$ docker login https://docker.pkg.github.com -u YOUR_GITHUB_USERNAME

and providing your personal access token as a password.

Check full instructions in the "Authenticating to GitHub packages" guide.

Specific docker images can be specified via the enviroment variable EVENTSTORE_IMAGE.

EventStoreDB Server Compatibility

This client is compatible with version 20.6.1 upwards.

Server setup instructions can be found in the docs, 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.

class AccountCreated {
    private UUID id;
    private String login;

    public UUID getId() {
        return id;
    }

    public String getLogin() {
        return login;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public void setLogin(String login) {
        this.login = login;
    }
}
import com.eventstore.dbclient.EventStoreDBClient;
import com.eventstore.dbclient.EventStoreDBClientSettings;
import com.eventstore.dbclient.EventStoreDBConnectionString;
import com.eventstore.dbclient.GrpcClient;
import com.eventstore.dbclient.EventData;
import com.eventstore.dbclient.WriteResult;
import com.eventstore.dbclient.ReadResult;

public class Main {
    public static void main(String args[]) {
        EventStoreDbClientSettings setts = EventStoreDBConnectionString.parseOrThrow("esdb://localhost:2113");
        EventStoreDbClient client = EventStoreDbClient.create(setts);

        AccountCreated createdEvent = new AccountCreated();

        createdEvent.setId(UUID.randomUUID());
        createdEvent.setLogin("ouros");

        EventData event = EventData
                .builderAsJson("account-created", createdEvent)
                .build();

        WriteResult writeResult = client
                .appendToStream("accounts", event)
                .get();

        ReadStreamOptions readStreamOptions = ReadStreamOptions.get()
                .fromStart()
                .notResolveLinks();

        ReadResult readResult = client
                .readStream("accounts", 1, readStreamOptions)
                .get();

        ResolvedEvent resolvedEvent = readResult
                .getEvents()
                .get(0);

        AccountCreated writtenEvent = 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:

EventStoreDbClientSettings setts = EventStoreDBConnectionString.parseOrThrow("esdb://localhost:2113");
EventStoreDBProjectionManagementClient client = EventStoreDBProjectionManagementClient.create(setts);

client
    .createContinuous(PROJECTION_NAME, PROJECTION_JS)
    .get();

Define a class in which to deserialize the result:

public class CountResult {

    private int count;

    public int getCount() {
        return count;
    }

    public void setCount(final int count) {
        this.count = count;
    }
}

Get the result:

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

For further details please see the projection management tests.

Support

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

Documentation

Documentation for EventStoreDB can be found in the docs.

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

Community

We have a community discussion space at Event Store Discuss.

Contributing

All contributions to the SDK are made via GitHub Pull Requests, and must be licensed under the Apache 2.0 license. Please review our Contributing Guide and Code of Conduct for more information.

About

Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6

eventstore.com

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.