Getting to know the Java client
In this article you will learn how to configure and create the different clients the Serialized client library provides and get to know a bit about when to use which client.
The client source code is available on Github. If you're interested in helping out with the client, please let us know!
Installing the client library
The client is available via Maven central. To add the client to your Maven/Gradle project, add the following dependency to your
<dependency> <groupId>io.serialized</groupId> <artifactId>serialized-client</artifactId> <version>6.8.0</version> </dependency>
Configuring the client
To use the Java client you start by configuring it for your project. The API keys for your project can be found by logging in to the Web Console , navigating to your project and selecting API Keys.
SerializedClientConfig config = SerializedClientConfig.serializedConfig() .accessKey("YOUR_ACCESS_KEY") .secretAccessKey("<YOUR_SECRET_ACCESS_KEY") .build();
You find your API keys in the Serialized Console under Project settings:
The client library consists of a number of different clients that serves the need for the different kinds of application or service you are developing.
You use the Aggregates client to work with aggregates and their events. An aggregate is a concept from Domain-Driven Design that serves as a consistency boundary within your application.
The Serialized Java client library provides the Aggregate client via the class:
Use the aggregate client to save events and to maintain the consistency of your aggregates via optimistic concurrency control. This client can serve as a core infrastructure component in the write-side of your CQRS-application.
To serve data to your client applications you will soon want to transform your events to tailored projections (or read-models). The projections client helps you define these projection transformation definitions and to query the projection data that is stored as a result of these transformations.
The entry point in the Projection client is the class:
To efficiently build event-driven workflows and integration points you can use the reactions client to define event-triggered reactions. You can also use the Reactions client to provide scheduling functionality to your application.
The Reactions client has its entry point in the class:
The feed client provides a raw, Atom-like feed of the events you store. It provides different filters and query options that you use to build custom read-models or event-triggers when the Projections/Reactions clients are not dynamic or flexible enough for your use case.
The entry point for the Feed client is the class