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
How to create and destroy streams.
The wording of this can become much better once agreement occurs in https://github.com/ReactiveX/RxJava/pull/3348/files
The intent of this is:
1) Specify how to create streams (Observable/Flowable) of the various flavors, and account for flow control.
2) Evolve towards what the creation/generation APIs are
3) Specify that it is not the responsibility of the final Subscriber to call unsubscribe/cancel upstream
- If `request(n)` behavior is supported in the stream implementation, then:
95
+
- pull-based creation must support `request(n)` semantics
96
+
- push-based creation must provide a default *onBackpressure* strategy
97
+
- If `request(n)` behavior is not supported in the stream implementation, then:
98
+
- push-based creation can push without consideration of a backpressure strategy
99
+
- pull-based creation should be discouraged
100
+
101
+
##### Destruction
102
+
103
+
A producer can terminate a stream by emitting `onComplete` or `onError`. A consumer can terminate a stream by calling `cancel`.
104
+
105
+
Any resource cleanup of the source or operators must account for any of these three termination events. In other words, if an operator needs cleanup, then it should register the cleanup callback with `cancel`, `onError` and `onComplete`.
106
+
107
+
The final `subscribe` will *not* invoke `cancel` after receiving an `onComplete` or `onError`.
0 commit comments