Skip to content

Commit e2603e7

Browse files
codecopmtumilowicz
authored andcommitted
Format markdown.
Conflicts: README.md
1 parent 35f07bf commit e2603e7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
* http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/schedulers/Schedulers.html
2222

2323
## preface
24+
2425
The main goal of this project is to explore basic features of
2526
`reactive streams` introduced in `Java 9`:
27+
2628
* **Publisher**
2729
* **Subscriber**
2830
* **Subscription** (**Backpressure**)
@@ -198,6 +200,7 @@ then closes the connection and disconnects from the server
198200
```
199201
200202
## definitions
203+
201204
* **[Flow.Publisher](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Publisher.html)** -
202205
source of data
203206
* **[Flow.Subscriber](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Subscriber.html)** -
@@ -213,19 +216,24 @@ the only one implementation (in `JDK`) of `Flow.Publisher`; has ability to async
213216
items to current subscribers until it is closed.
214217
215218
## data flow
219+
216220
```
217221
PUBLISHER -> PROCESSOR -> PROCESSOR -> SUBSCRIBER
218222
```
223+
219224
We have two scenarios:
225+
220226
* `Publisher` is slow, `Subscriber` is fast (best scenario)
221227
* `Publisher` is fast, `Subscriber` is slow (the `Subscriber` must deal
228+
222229
with excessive data - the most naive approach is just to drop all
223-
excessive data - so the data will be irrevitable)
230+
excessive data - so the data will be lost)
224231
225232
Note that if we have multiple `subscribers` and one `publisher` - they
226233
are receiving elements in the same order.
227234
228235
## interaction steps
236+
229237
1. implement `Flow.Publisher` (using, for example `SubmissionPublisher<T>`) and `Flow.Subscriber`
230238
1. the subscriber attempts to subscribe to the publisher by calling the
231239
`subscribe(Flow.Subscriber<? super T> subscriber)
@@ -250,7 +258,9 @@ the end of stream, and interaction ends
250258
cancellation if there were pending requests before
251259
252260
## additional remarks
261+
253262
Correctly `@Override` method `onSubscribe` looks as below:
263+
254264
```
255265
@Override
256266
public void onSubscribe(Flow.Subscription subscription) {
@@ -276,10 +286,14 @@ one, we don't accept any furthers)
276286
implementations
277287
278288
## tests
289+
279290
We test it by running:
291+
280292
* `RunAnswer`
281293
* `RunWorkshop`
294+
282295
the output should be:
296+
283297
```
284298
onNext, item: new mapping: 2
285299
onNext, item: new mapping: 4

0 commit comments

Comments
 (0)