Skip to content

Commit 53a02cb

Browse files
authored
Update README.md
1 parent 53c957d commit 53a02cb

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ The main goal of this project is to explore basic features of
1818
## definitions
1919
Conceptual map:
2020
* **[Flow.Publisher](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Publisher.html)** -
21-
source of data.
21+
source of data
2222
* **[Flow.Subscriber](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Subscriber.html)** -
23-
destination of data.
23+
destination of data
2424
* **[Flow.Subscription](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Subscription.html)** -
2525
message control linking a `Flow.Publisher` and `Flow.Subscriber`
26-
(`Subscriber` signal demand to `Publisher`).
26+
(`Subscriber` signal demand to `Publisher` using `Subscription`)
2727
* **[Flow.Processor](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Processor.html)** -
2828
a component that acts as both a `Subscriber` and `Publisher` (can
2929
consume input and produce output).
3030
* **[Flow.SubmissionPublisher](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/SubmissionPublisher.html)** -
31-
It's the only one implementation (in `JDK`) of `Flow.Publisher`.
32-
Moreover - has ability to asynchronously issue submitted (non-null)
31+
the only one implementation (in `JDK`) of `Flow.Publisher`; has ability to asynchronously issue submitted (non-null)
3332
items to current subscribers until it is closed.
3433

3534
## data flow
@@ -40,28 +39,27 @@ We have two scenarios:
4039
* `Publisher` is slow, `Subscriber` is fast (best scenario)
4140
* `Publisher` is fast, `Subscriber` is slow (the `Subscriber` must deal
4241
with excessive data - the most naive approach is just to drop all
43-
excessive data - so the data will be irrevitable).
42+
excessive data - so the data will be irrevitable)
4443

4544
Note that if we have multiple `subscribers` and one `publisher` - they
4645
are receiving elements in the same order.
4746

4847
## interaction steps
49-
1. Implement `Flow.Publisher` (useful, existing implementation that can be extended: `SubmissionPublisher<T>`)
50-
and `Flow.Subscriber`
51-
1. The subscriber attempts to subscribe to the publisher by calling the
48+
1. implement `Flow.Publisher` (using, for example `SubmissionPublisher<T>`) and `Flow.Subscriber`
49+
1. the subscriber attempts to subscribe to the publisher by calling the
5250
`subscribe(Flow.Subscriber<? super T> subscriber)`
5351
method of the publisher
5452
* success: the publisher asynchronously calls the `onSubscribe(Flow.Subscription subscription)`
5553
method of the subscriber
5654
* failure: `onError(Throwable throwable)` method of the subscriber is called
5755
with an `IllegalStateException`, and the interaction ends
58-
1. The subscriber sends a request to the publisher for `N` items calling the `request(N)`
56+
1. the subscriber sends a request to the publisher for `N` items calling the `request(N)`
5957
on the `Subscription`
60-
1. Multiple requests are send regardless if earlier are already fulfilled (non-blocking)
61-
1. The publisher calls the `onNext(T item)` method of the subscriber and sends an item in each call
58+
1. multiple requests are send regardless if earlier are already fulfilled (non-blocking)
59+
1. the publisher calls the `onNext(T item)` method of the subscriber and sends an item in each call
6260
* if there is no more items to send the publisher calls the `onComplete()` method of the subscriber to signal
6361
the end of stream, and interaction ends
64-
* note that if subscriber requested `Long.MAX_VALUE` items, the stream becomes not reactive - it is
62+
* note that if subscriber requests `Long.MAX_VALUE` items, the stream becomes not reactive - it is
6563
effectively a push stream
6664
1. if the publisher encounters an error - calls `onError(Throwable throwable)` on subscriber
6765
1. the subscriber can cancel its subscription by calling the `cancel()` method on its subscription

0 commit comments

Comments
 (0)