diff --git a/docs/api/appending-events.md b/docs/api/appending-events.md index cce8a2e4..797b7502 100644 --- a/docs/api/appending-events.md +++ b/docs/api/appending-events.md @@ -14,7 +14,13 @@ Check the [Getting Started](getting-started.md) guide to learn how to configure The simplest way to append an event to KurrentDB is to create an `EventData` object and call `appendToStream` method. -```java {32-43} +```java {38-49} +import io.kurrent.dbclient.AppendToStreamOptions; +import io.kurrent.dbclient.EventData; +import io.kurrent.dbclient.StreamState; + +import java.util.UUID; + class OrderPlaced { private String orderId; private String customerId; diff --git a/docs/api/getting-started.md b/docs/api/getting-started.md index b43ca9b4..ef810c52 100644 --- a/docs/api/getting-started.md +++ b/docs/api/getting-started.md @@ -102,6 +102,10 @@ When connecting to an insecure instance, specify `tls=false` parameter. For exam First, create a client and get it connected to the database. ```java +import io.kurrent.dbclient.KurrentDBClient; +import io.kurrent.dbclient.KurrentDBClientSettings; +import io.kurrent.dbclient.KurrentDBConnectionString; + KurrentDBClientSettings settings = KurrentDBConnectionString.parseOrThrow("kurrentdb://localhost:2113?tls=false"); KurrentDBClient client = KurrentDBClient.create(settings); ``` @@ -115,6 +119,9 @@ You can write anything to KurrentDB as events. The client needs a byte array as The code snippet below creates an event object instance, serializes it, and adds it as a payload to the `EventData` structure, which the client can then write to the database. ```java +import io.kurrent.dbclient.EventData; +import com.fasterxml.jackson.databind.json.JsonMapper; + public class OrderPlaced { private String orderId; private String customerId;