Skip to content

Commit 3b3d141

Browse files
authored
Add package imports to Java getting-started and appending-events examples (#393)
1 parent 31f98b8 commit 3b3d141

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

docs/api/appending-events.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ Check the [Getting Started](getting-started.md) guide to learn how to configure
1414

1515
The simplest way to append an event to KurrentDB is to create an `EventData` object and call `appendToStream` method.
1616

17-
```java {32-43}
17+
```java {38-49}
18+
import io.kurrent.dbclient.AppendToStreamOptions;
19+
import io.kurrent.dbclient.EventData;
20+
import io.kurrent.dbclient.StreamState;
21+
22+
import java.util.UUID;
23+
1824
class OrderPlaced {
1925
private String orderId;
2026
private String customerId;

docs/api/getting-started.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ When connecting to an insecure instance, specify `tls=false` parameter. For exam
102102
First, create a client and get it connected to the database.
103103

104104
```java
105+
import io.kurrent.dbclient.KurrentDBClient;
106+
import io.kurrent.dbclient.KurrentDBClientSettings;
107+
import io.kurrent.dbclient.KurrentDBConnectionString;
108+
105109
KurrentDBClientSettings settings = KurrentDBConnectionString.parseOrThrow("kurrentdb://localhost:2113?tls=false");
106110
KurrentDBClient client = KurrentDBClient.create(settings);
107111
```
@@ -115,6 +119,9 @@ You can write anything to KurrentDB as events. The client needs a byte array as
115119
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.
116120

117121
```java
122+
import io.kurrent.dbclient.EventData;
123+
import com.fasterxml.jackson.databind.json.JsonMapper;
124+
118125
public class OrderPlaced {
119126
private String orderId;
120127
private String customerId;

0 commit comments

Comments
 (0)