Skip to content

Commit 4013411

Browse files
authored
sync the examples with version 0.4.0 (#24)
1 parent 640c341 commit 4013411

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
This is the offical Java client library for [HStreamDB](https://hstream.io/).
88

9-
**Please use the latest released version.**
9+
**Please use the latest released version.**
1010

11-
**The latest release is v0.3.0, which requires hstream server v0.5.2 .**
11+
**The latest release is v0.4.0, which requires hstream server v0.5.2 .**
1212

13-
## Content
13+
## Content
1414
- [Installation](#installation)
1515
- [Maven](#maven)
1616
- [Gradle](#gradle)
@@ -23,7 +23,7 @@ This is the offical Java client library for [HStreamDB](https://hstream.io/).
2323

2424
## Installation
2525

26-
The library artifact is published in Maven central,
26+
The library artifact is published in Maven central,
2727
available at [hstreamdb-java](https://search.maven.org/artifact/io.hstream/hstreamdb-java).
2828

2929
### Maven
@@ -42,7 +42,7 @@ For Maven Users, the library can be included easily like this:
4242

4343
```
4444

45-
### Gradle
45+
### Gradle
4646

4747
For Gradle Users, the library can be included easily like this:
4848

@@ -52,7 +52,7 @@ implementation 'io.hstream:hstreamdb-java:${hstreamdbClientVersion}'
5252
5353
```
5454

55-
## Example Usage
55+
## Example Usage
5656

5757
### Connect to HStreamDB
5858

@@ -71,11 +71,11 @@ public class ConnectExample {
7171

7272
```
7373

74-
### Work with Streams
74+
### Work with Streams
7575

7676
```java
7777

78-
// get a list of streams
78+
// get a list of streams
7979
for(Stream stream: client.listStreams()) {
8080
System.out.println(stream.getStreamName());
8181
}
@@ -90,7 +90,7 @@ client.deleteStream("test_stream");
9090

9191
```
9292

93-
### Write Data to a Stream
93+
### Write Data to a Stream
9494

9595
```java
9696

@@ -134,7 +134,7 @@ batchedProducer.flush()
134134
**Please do not write both binary data and hrecord in one stream.**
135135

136136

137-
### Consume Data from a Stream
137+
### Consume Data from a Stream
138138

139139
```java
140140
// first, create a subscription for the stream
@@ -162,7 +162,7 @@ consumer.startAsync().awaitRunning();
162162

163163
```
164164

165-
### Process Data in Stream with SQL
165+
### Process Data in Stream with SQL
166166

167167
```java
168168

@@ -183,15 +183,15 @@ Observer<HRecord> observer =
183183
public void onCompleted() {}
184184
};
185185

186-
// second, create a queryer to execute a sql
186+
// second, create a queryer to execute a sql
187187
Queryer queryer =
188188
client
189189
.newQueryer()
190190
.sql("select * from test_stream emit changes;")
191191
.resultObserver(observer)
192192
.build();
193193

194-
// third, start the queryer
194+
// third, start the queryer
195195
queryer.startAsync().awaitRunning();
196196

197197
```

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Prerequisites
44

55
- hstreamdb server [v0.5.2.0](https://hub.docker.com/layers/hstreamdb/hstream/v0.5.2.0/images/sha256-d26234758cd47916d6a5d137a3690cdeeddaf7af041a8eea5e7c1d7ada43f3b8)
6-
- hstreamdb-java [v0.3.0](https://search.maven.org/artifact/io.hstream/hstreamdb-java/0.3.0/jar)
6+
- hstreamdb-java [v0.4.0](https://search.maven.org/artifact/io.hstream/hstreamdb-java/0.4.0/jar)
77

88
## Examples
99

examples/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories {
1010
}
1111

1212
dependencies {
13-
implementation 'io.hstream:hstreamdb-java:0.3.0'
13+
implementation 'io.hstream:hstreamdb-java:0.4.0'
1414
}
1515

1616
application {

examples/app/src/main/java/io/hstream/example/ConsumerExample.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ public static void main(String[] args) {
1414
client.createStream(DEMO_STREAM);
1515

1616
Subscription subscription =
17-
Subscription.newBuilder()
18-
.setSubscriptionId(DEMO_SUBSCRIPTION)
19-
.setStreamName(DEMO_STREAM)
20-
.setOffset(
21-
SubscriptionOffset.newBuilder()
22-
.setSpecialOffset(SubscriptionOffset.SpecialOffset.EARLIST)
23-
.build())
24-
.build();
17+
new Subscription(
18+
DEMO_SUBSCRIPTION,
19+
DEMO_STREAM,
20+
new SubscriptionOffset(SubscriptionOffset.SpecialOffset.LATEST));
2521
client.createSubscription(subscription);
2622

2723
Producer producer =

0 commit comments

Comments
 (0)