You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Backpressure.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Cold Observables are ideal for the reactive pull model of backpressure described
20
20
21
21
Your first line of defense against the problems of over-producing Observables is to use some of the ordinary set of Observable operators to reduce the number of emitted items to a more manageable number. The examples in this section will show how you might use such operators to handle a bursty Observable like the one illustrated in the following marble diagram:
Or you could get fancy, and collect items in buffers during the bursty periods and emit them at the end of each burst, by using the `debounce` operator to emit a buffer closing indicator to the `buffer` operator:
@@ -158,11 +158,11 @@ For this to work, though, Observables _A_ and _B_ must respond correctly to the
158
158
159
159
<dl>
160
160
<dt><tt>onBackpressureBuffer</tt></dt>
161
-
<dd>maintains a buffer of all emissions from the source Observable and emits them to downstream Subscribers according to the <tt>request</tt>s they generate<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.buffer.png"width="640"height="300" /><br />an experimental version of this operator (not available in RxJava 1.0) allows you to set the capacity of the buffer; applying this operator will cause the resulting Observable to terminate with an error if this buffer is overrun</dd>
161
+
<dd>maintains a buffer of all emissions from the source Observable and emits them to downstream Subscribers according to the <tt>request</tt>s they generate<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.buffer.v3.png"width="640"height="300" /><br />an experimental version of this operator (not available in RxJava 1.0) allows you to set the capacity of the buffer; applying this operator will cause the resulting Observable to terminate with an error if this buffer is overrun</dd>
162
162
<dt><tt>onBackpressureDrop</tt></dt>
163
-
<dd>drops emissions from the source Observable unless there is a pending <tt>request</tt> from a downstream Subscriber, in which case it will emit enough items to fulfill the request<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.drop.png"width="640"height="245" /></dd>
163
+
<dd>drops emissions from the source Observable unless there is a pending <tt>request</tt> from a downstream Subscriber, in which case it will emit enough items to fulfill the request<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.drop.v3.png"width="640"height="245" /></dd>
164
164
<dt><tt>onBackpressureBlock</tt> <emstyle="color: #f00;">(experimental, not in RxJava 1.0)</em></dt>
165
-
<dd>blocks the thread on which the source Observable is operating until such time as a Subscriber issues a <tt>request</tt> for items, and then unblocks the thread only so long as there are pending requests<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.block.png"width="640"height="245" /></dd>
165
+
<dd>blocks the thread on which the source Observable is operating until such time as a Subscriber issues a <tt>request</tt> for items, and then unblocks the thread only so long as there are pending requests<br /><imgsrc="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/bp.obp.block.v3.png"width="640"height="245" /></dd>
166
166
</dl>
167
167
168
168
If you do not apply any of these operators to an Observable that does not support backpressure, _and_ if either you as the Subscriber or some operator between you and the Observable attempts to apply reactive pull backpressure, you will encounter a `MissingBackpressureException` which you will be notified of via your `onError()` callback.
Copy file name to clipboardExpand all lines: docs/Blocking-Observable-Operators.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ To transform an `Observable` into a `BlockingObservable`, use the [`Observable.t
18
18
19
19
> This documentation accompanies its explanations with a modified form of "marble diagrams." Here is how these marble diagrams represent Blocking Observables:
Copy file name to clipboardExpand all lines: docs/Connectable-Observable-Operators.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This section explains the [`ConnectableObservable`](http://reactivex.io/RxJava/j
7
7
8
8
A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its `connect()` method is called. In this way you can wait for all intended Subscribers to subscribe to the Observable before the Observable begins emitting items.
The following example code shows two Subscribers subscribing to the same Observable. In the first case, they subscribe to an ordinary Observable; in the second case, they subscribe to a Connectable Observable that only connects after both Subscribers subscribe. Note the difference in the output:
This next example, in Clojure, consumes three asynchronous Observables, including a dependency from one to another, and emits a single response item by combining the items emitted by each of the three Observables with the [`zip`](http://reactivex.io/documentation/operators/zip.html) operator and then transforming the result with [`map`](http://reactivex.io/documentation/operators/map.html):
291
291
@@ -333,7 +333,7 @@ The response looks like this:
333
333
334
334
And here is a marble diagram that illustrates how that code produces that response:
The following example, in Groovy, comes from [Ben Christensen’s QCon presentation on the evolution of the Netflix API](https://speakerdeck.com/benjchristensen/evolution-of-the-netflix-api-qcon-sf-2013). It combines two Observables with the [`merge`](http://reactivex.io/documentation/operators/merge.html) operator, then uses the [`reduce`](http://reactivex.io/documentation/operators/reduce.html) operator to construct a single item out of the resulting sequence, then transforms that item with [`map`](http://reactivex.io/documentation/operators/map.html) before emitting it:
339
339
@@ -350,7 +350,7 @@ public Observable getVideoSummary(APIVideo video) {
350
350
351
351
And here is a marble diagram that illustrates how that code uses the [`reduce`](http://reactivex.io/documentation/operators/reduce.html) operator to bring the results from multiple Observables together in one structure:
0 commit comments