22
33![ Build Status] ( https://github.com/hstreamdb/hstreamdb-java/actions/workflows/main.yml/badge.svg )
44[ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.hstream/hstreamdb-java )] ( https://search.maven.org/artifact/io.hstream/hstreamdb-java )
5- [ ![ javadoc] ( https://javadoc.io/badge2/io.hstream/hstreamdb-java/0.5.0 /javadoc.svg )] ( https://javadoc.io/doc/io.hstream/hstreamdb-java/0.5.0 )
5+ [ ![ javadoc] ( https://javadoc.io/badge2/io.hstream/hstreamdb-java/0.5.1 /javadoc.svg )] ( https://javadoc.io/doc/io.hstream/hstreamdb-java/0.5.1 )
66[ ![ Snapshot Artifacts] ( https://img.shields.io/nexus/s/https/s01.oss.sonatype.org/io.hstream/hstreamdb-java.svg )] ( https://s01.oss.sonatype.org/content/repositories/snapshots/io/hstream/hstreamdb-java/0.5.1-SNAPSHOT/ )
77[ ![ javadoc] ( https://javadoc.io/badge2/io.hstream/hstreamdb-java/0.5.1-SNAPSHOT/javadoc.svg )] ( https://hstreamdb.github.io/hstreamdb-java/javadoc/ )
88
99This is the offical Java client library for [ HStreamDB] ( https://hstream.io/ ) .
1010
1111** Please use the latest released version.**
1212
13- ** The latest release is v0.5.0 , which requires hstream server v0.5.3 .**
13+ ** The latest release is v0.5.1 , which requires hstream server v0.5.3 .**
1414
1515## Content
1616- [ Installation] ( #installation )
@@ -38,7 +38,7 @@ For Maven Users, the library can be included easily like this:
3838 <dependency >
3939 <groupId >io.hstream</groupId >
4040 <artifactId >hstreamdb-java</artifactId >
41- <version >0.5.0 </version >
41+ <version >0.5.1 </version >
4242 </dependency >
4343</dependencies >
4444
@@ -50,7 +50,7 @@ For Gradle Users, the library can be included easily like this:
5050
5151``` groovy
5252
53- implementation 'io.hstream:hstreamdb-java:0.5.0 '
53+ implementation 'io.hstream:hstreamdb-java:0.5.1 '
5454
5555```
5656
@@ -86,6 +86,9 @@ for(Stream stream: client.listStreams()) {
8686// create a new stream
8787client. createStream(" test_stream" );
8888
89+ // create a new stream with 5 replicas
90+ client. createStream(" test_stream" , 5 );
91+
8992
9093// delete a stream
9194client. deleteStream(" test_stream" );
@@ -98,24 +101,18 @@ client.deleteStream("test_stream");
98101
99102Producer producer = client. newProducer(). stream(" test_stream" ). build();
100103
101- // write raw records synchronously
104+ // write raw records
102105Random random = new Random ();
103106byte [] rawRecord = new byte [100 ];
104107random. nextBytes(rawRecord);
105- RecordId recordId = producer. write(rawRecord);
106-
107- // write raw records asynchronously
108- CompletableFuture<RecordId > future = producer. writeAsync(rawRecord);
108+ CompletableFuture<RecordId > future = producer. write(rawRecord);
109109
110- // write hRecords synchronously
110+ // write hRecords
111111HRecord hRecord = HRecord . newBuilder()
112112 .put(" key1" , 10 )
113113 .put(" key2" , " hello" )
114114 .put(" key3" , true )
115115 .build();
116- RecordId recordId = producer. write(hRecord);
117-
118- // write hRecords asynchronously
119116CompletableFuture<RecordId > future = producer. write(hRecord);
120117
121118// buffered writes
@@ -126,9 +123,8 @@ Producer batchedProducer = client.newProducer()
126123 .build();
127124for (int i = 0 ; i < 1000 ; ++ i) {
128125 random. nextBytes(rawRecord);
129- batchedProducer. writeAsync (rawRecord);
126+ batchedProducer. write (rawRecord);
130127}
131- batchedProducer. flush()
132128
133129
134130```
0 commit comments