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
+12-12
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="/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.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="/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.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="/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.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.
@@ -172,4 +172,4 @@ If you do not apply any of these operators to an Observable that does not suppor
172
172
If the standard operators are providing the expected behavior, [one can write custom operators in RxJava](https://github.com/ReactiveX/RxJava/wiki/Implementing-custom-operators-(draft)).
0 commit comments