Skip to content

Commit c68b0b1

Browse files
authored
Update README.adoc
1 parent c1f0b8b commit c68b0b1

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.adoc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ You can choose to receive snapshots only or one snapshot and then patches you do
2828
`java -jar target/streamdataio-sdk-java-1.0.jar`
2929

3030
* You should see data and patches pushed in your application and displayed on your terminal.
31-
* You can build the jar on you own and use provided classes to use this API
32-
you can use the provided demo example API which simulates updating stocks prices from a financial market: 'http://stockmarket.streamdata.io/v2/prices'
31+
* You can build the jar on your own and use provided classes to use this API.
32+
You can use the provided demo which stream an API of factice financial market: 'http://stockmarket.streamdata.io/v2/prices'
3333

34-
Feel free to test it with any REST/Json API of your choice.
34+
Feel free to test it with any REST/Json API of your choice. You can add authorization headers and query params.
3535

3636

3737
=== How to integrate the API into your project
3838

3939
*Maven*
4040

41+
_after building this project_
42+
4143
[xml]
4244
----
4345
<dependency>
@@ -76,10 +78,10 @@ String appKey = "YOUR OWN APP KEY";
7678
EventSourceClient client = StreamdataClient.createClient(apiURL, appKey);
7779
client.addHeader("X-MYAPI-POLLER", "Polled By SD.io") # <2>
7880
.useJsonPatch(true) # <3>
79-
.onSnapshot(data -> this::processData) # <4>
81+
.onSnapshot(this::processData) # <4>
8082
.onPatch(patch -> this.processPatch(patch, client.getCurrentSnaphot())) # <5>
8183
.onOpen(() -> logger.info("And we are... live!")) # <6>
82-
.onClose(() -> logger.info("And we are... live!")) # <7>
84+
.onClose(() -> logger.info("And we are... dead!")) # <7>
8385
.onError(err -> logger.error("An error occured {}", err)) # <8>
8486
.onException(ex -> logger.error("Unexpected error", ex)) # <9>
8587
.open(); # <10>
@@ -90,11 +92,11 @@ client.addHeader("X-MYAPI-POLLER", "Polled By SD.io")
9092
<3> This allows you let streamdata send snapshots only (set `false` to do so) or snapshot then patch (default behaviour if you don't call this method) [_Optional_ ]
9193
<4> A callback that will consume the snapshot
9294
<5> A callback that will consume the patch (you can access the snaphost anyways) [_Optional_ ]
93-
<6> Call when successfully open the connection [_Optional_ ]
94-
<7> Call the connection is actually closed [_Optional_ ]
95-
<6> Call when the stream return an error, by default the error is logged usually it is recommended to close the connection: ```client.close()``` [_Optional_ ]
96-
<7> Call when an error occurs, mainly when opening the event source, by default the error is recommended to close the connection: ```client.close()``` [_Optional_ ]
97-
<10> Open the connection with the server
95+
<6> Called when successfully open the connection [_Optional_ ]
96+
<7> Called the connection is actually closed [_Optional_ ]
97+
<6> Called when the stream return an error, by default the error is logged. Usually it is recommended to close the connection: ```client.close()``` [_Optional_ ]
98+
<7> Call when an error occurs, mainly when opening the event source, by default the error is logged but it is recommended to close the connection: ```client.close()``` [_Optional_ ]
99+
<10> Open the connection with the server and start streamdata.
98100

99101

100102
=== RxJava based API
@@ -112,7 +114,7 @@ String appKey = "YOUR OWN APP KEY";
112114
113115
StreamdataClient.createRxJavaClient(apiURL, appKey)
114116
.addHeader("X-MYAPI-POLLER", "Polled By SD.io") # <2>
115-
.useJsonPatch(true) # <3>
117+
.useJsonPatch(true) # <3>
116118
.toFlowable() # <4>
117119
// here you can add operator to manipulate the flow
118120
.subscribe(event -> { # <5>
@@ -129,7 +131,7 @@ StreamdataClient.createRxJavaClient(apiURL, appKey)
129131
<1> Same as above
130132
<2> Same as above
131133
<3> Same as above
132-
<4> Once configured you can start manipulating you data
134+
<4> Once configured you can start manipulating you data or use specific schedulers
133135
<5> An example without using any rx operators before show you available methods on event
134136
<6> Shis will stop the flowable and disconnect the event source
135137

0 commit comments

Comments
 (0)