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
*[Imperative versus declarative](#imperative-versus-declarative)
60
60
*[Launching flow](#launching-flow)
61
+
*[Flow and Reactive Streams](#flow-and-reactive-streams)
61
62
62
63
<!--- END_TOC -->
63
64
@@ -1794,6 +1795,18 @@ as cancellation and structured concurrency serve this purpose.
1794
1795
Note that [launchIn] also returns a [Job], which can be used to [cancel][Job.cancel] the corresponding flow collection
1795
1796
coroutine only without cancelling the whole scope or to [join][Job.join] it.
1796
1797
1798
+
### Flow and Reactive Streams
1799
+
1800
+
For those who are familiar with [Reactive Streams](https://www.reactive-streams.org/) or reactive frameworks such as RxJava and project Reactor,
1801
+
design of the Flow may look very familiar.
1802
+
1803
+
Indeed, its design was inspired by Reactive Streams and its various implementations. But Flow main goal is to have as simple design as possible,
1804
+
be Kotlin and suspension friendly and respect structured concurrency. Achieving this goal would be impossible without reactive pioneers and their tremendous work. You can read the complete story in [Reactive Streams and Kotlin Flows](https://medium.com/@elizarov/reactive-streams-and-kotlin-flows-bfd12772cda4) article.
1805
+
1806
+
While being different, conceptually, Flow *is* a reactive stream and it is possible to convert it to the reactive (spec and TCK compliant) Publisher and vice versa.
1807
+
Such converters are provided by `kotlinx.coroutines` out-of-the-box and can be found in corresponding reactive modules (`kotlinx-coroutines-reactive` for Reactive Streams, `kotlinx-coroutines-reactor` for Project Reactor and `kotlinx-coroutines-rx2` for RxJava2).
1808
+
Integration modules include conversions from and to `Flow`, integration with Reactor's `Context` and suspension-friendly ways to work with various reactive entities.
0 commit comments