Skip to content

Commit 2d5ce35

Browse files
authored
rework reactivestreams docs (#2468)
* rework reactivestreams docs * tidy up * link issues
1 parent 274d704 commit 2d5ce35

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

docs/src/main/paradox/stream/operators/Sink/asPublisher.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Integration with Reactive Streams, materializes into a `org.reactivestreams.Publ
1515
This method gives you the capability to publish the data from the `Sink` through a Reactive Streams [Publisher](https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/org/reactivestreams/Publisher.html).
1616
Generally, in Pekko Streams a `Sink` is considered a subscriber, which consumes the data from source. To integrate with other Reactive Stream implementations `Sink.asPublisher` provides a `Publisher` materialized value when run.
1717
Now, the data from this publisher can be consumed by subscribing to it. We can control if we allow more than one downstream subscriber from the single running Pekko stream through the `fanout` parameter.
18+
1819
In Java 9, the Reactive Stream API was included in the JDK, and `Publisher` is available through [Flow.Publisher](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Publisher.html).
19-
Since those APIs are identical but exist at different package namespaces and does not depend on the Reactive Streams package a separate publisher sink for those is available
20+
Since those APIs are identical but exist at different package namespaces and does not depend on the Reactive Streams package a separate API for those is available
2021
through @scala[`org.apache.pekko.stream.scaladsl.JavaFlowSupport.Sink#asPublisher`]@java[`org.apache.pekko.stream.javadsl.JavaFlowSupport.Sink#asPublisher`].
2122

2223

docs/src/main/paradox/stream/operators/Sink/fromSubscriber.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ Integration with Reactive Streams, wraps a `org.reactivestreams.Subscriber` as a
1111

1212
## Description
1313

14-
TODO: We would welcome help on contributing descriptions and examples, see: https://github.com/akka/akka/issues/25646
14+
In Java 9, the Reactive Stream API was included in the JDK, and `Subscriber` is available through [Flow.Subscriber](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Subscriber.html).
15+
Since those APIs are identical but exist at different package namespaces and does not depend on the Reactive Streams package a separate API for those is available
16+
through @scala[`org.apache.pekko.stream.scaladsl.JavaFlowSupport.Sink#fromSubscriber`]@java[`org.apache.pekko.stream.javadsl.JavaFlowSupport.Sink#fromSubscriber`].

docs/src/main/paradox/stream/operators/Source/asSubscriber.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Source.asSubscriber
22

3-
Integration with Reactive Streams, materializes into a @javadoc[Subscriber](java.util.concurrent.Flow.Subscriber).
3+
Integration with Reactive Streams, materializes into a `org.reactivestreams.Subscriber`.
44

55
@ref[Source operators](../index.md#source-operators)
66

@@ -10,25 +10,23 @@ Scala
1010
: @@snip[JavaFlowSupport.scala](/stream/src/main/scala/org/apache/pekko/stream/scaladsl/JavaFlowSupport.scala) { #asSubscriber }
1111

1212
Java
13-
: @@snip[JavaFlowSupport.java](/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java) { #api }
13+
: @@snip[AsSubscriber.java](/docs/src/test/java/jdocs/stream/operators/source/AsSubscriber.java) { #api }
1414

1515
## Description
1616

1717
If you want to create a @apidoc[Source] that gets its elements from another library that supports
18-
[Reactive Streams](https://www.reactive-streams.org/), you can use `JavaFlowSupport.Source.asSubscriber`.
18+
[Reactive Streams](https://www.reactive-streams.org/), you can use `Source.asSubscriber`.
1919
Each time this @apidoc[Source] is materialized, it produces a materialized value of type
20-
@javadoc[java.util.concurrent.Flow.Subscriber](java.util.concurrent.Flow.Subscriber).
21-
This @javadoc[Subscriber](java.util.concurrent.Flow.Subscriber) can be attached to a
22-
[Reactive Streams](https://www.reactive-streams.org/) @javadoc[Publisher](java.util.concurrent.Flow.Publisher)
20+
@javadoc[org.reactivestreams.Subscriber](java.util.concurrent.Flow.Subscriber).
21+
This `org.reactivestreams.Subscriber` can be attached to a
22+
[Reactive Streams](https://www.reactive-streams.org/) `org.reactivestreams.Publisher`
2323
to populate it.
2424

25-
If the API you want to consume elements from provides a @javadoc[Publisher](java.util.concurrent.Flow.Publisher) instead of accepting a @javadoc[Subscriber](java.util.concurrent.Flow.Subscriber), see @ref[fromPublisher](fromPublisher.md).
25+
If the API you want to consume elements from provides a `org.reactivestreams.Publisher` instead of accepting a `org.reactivestreams.Subscriber`, see @ref[fromPublisher](fromPublisher.md).
2626

27-
@@@ note
28-
29-
Reactive Streams users: we prefer @javadoc[java.util.concurrent.Flow](java.util.concurrent.Flow) you may still use the [org.reactivestreams](https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams) library with @apidoc[Source.asSubscriber](Source$) { scala="#asSubscriber[T]:org.apache.pekko.stream.scaladsl.Source[T,org.reactivestreams.Subscriber[T]]" java="#asSubscriber()" }.
30-
31-
@@@
27+
In Java 9, the Reactive Stream API was included in the JDK, and `Subscriber` is available through [Flow.Subscriber](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Subscriber.html).
28+
Since those APIs are identical but exist at different package namespaces and does not depend on the Reactive Streams package a separate API for those is available
29+
through @scala[`org.apache.pekko.stream.scaladsl.JavaFlowSupport.Source#asSubscriber`]@java[`org.apache.pekko.stream.javadsl.JavaFlowSupport.Source#asSubscriber`].
3230

3331
## Example
3432

docs/src/main/paradox/stream/operators/Source/fromPublisher.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Source.fromPublisher
22

3-
Integration with Reactive Streams, subscribes to a @javadoc[Publisher](java.util.concurrent.Flow.Publisher).
3+
Integration with Reactive Streams, subscribes to a `org.reactivestreams.Publisher`.
44

55
@ref[Source operators](../index.md#source-operators)
66

@@ -16,17 +16,15 @@ Java
1616
## Description
1717

1818
If you want to create a @apidoc[Source] that gets its elements from another library that supports
19-
[Reactive Streams](https://www.reactive-streams.org/), you can use `JavaFlowSupport.Source.fromPublisher`.
20-
This source will produce the elements from the @javadoc[Publisher](java.util.concurrent.Flow.Publisher),
19+
[Reactive Streams](https://www.reactive-streams.org/), you can use `Source.fromPublisher`.
20+
This source will produce the elements from the `org.reactivestreams.Publisher`,
2121
and coordinate backpressure as needed.
2222

23-
If the API you want to consume elements from accepts a @javadoc[Subscriber](java.util.concurrent.Flow.Subscriber) instead of providing a @javadoc[Publisher](java.util.concurrent.Flow.Publisher), see @ref[asSubscriber](asSubscriber.md).
23+
If the API you want to consume elements from accepts a `org.reactivestreams.Subscriber` instead of providing a `org.reactivestreams.Publisher`, see @ref[asSubscriber](asSubscriber.md).
2424

25-
@@@ note
26-
27-
Reactive Streams users: we prefer @javadoc[java.util.concurrent.Flow](java.util.concurrent.Flow) but you may still use the [org.reactivestreams](https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams) library with @apidoc[Source.fromPublisher](Source$) { scala="#fromPublisher[T](publisher:org.reactivestreams.Publisher[T]):org.apache.pekko.stream.scaladsl.Source[T,org.apache.pekko.NotUsed]" java="#fromPublisher(org.reactivestreams.Publisher)" }.
28-
29-
@@@
25+
In Java 9, the Reactive Stream API was included in the JDK, and `Publisher` is available through [Flow.Publisher](https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.Publisher.html).
26+
Since those APIs are identical but exist at different package namespaces and does not depend on the Reactive Streams package a separate API for those is available
27+
through @scala[`org.apache.pekko.stream.scaladsl.JavaFlowSupport.Source#fromPublisher`]@java[`org.apache.pekko.stream.javadsl.JavaFlowSupport.Source#fromPublisher`].
3028

3129
## Example
3230

docs/src/main/paradox/stream/operators/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ These built-in sources are available from @scala[`org.apache.pekko.stream.scalad
88
| |Operator|Description|
99
|--|--|--|
1010
|Source|<a name="assourcewithcontext"></a>@ref[asSourceWithContext](Source/asSourceWithContext.md)|Extracts context data from the elements of a `Source` so that it can be turned into a `SourceWithContext` which can propagate that context per element along a stream.|
11-
|Source|<a name="assubscriber"></a>@ref[asSubscriber](Source/asSubscriber.md)|Integration with Reactive Streams, materializes into a @javadoc[Subscriber](java.util.concurrent.Flow.Subscriber).|
11+
|Source|<a name="assubscriber"></a>@ref[asSubscriber](Source/asSubscriber.md)|Integration with Reactive Streams, materializes into a `org.reactivestreams.Subscriber`.|
1212
|Source|<a name="combine"></a>@ref[combine](Source/combine.md)|Combine several sources, using a given strategy such as merge or concat, into one source.|
1313
|Source|<a name="completionstage"></a>@ref[completionStage](Source/completionStage.md)|Send the single value of the `CompletionStage` when it completes and there is demand.|
1414
|Source|<a name="completionstagesource"></a>@ref[completionStageSource](Source/completionStageSource.md)|Streams the elements of an asynchronous source once its given *completion* operator completes.|
@@ -20,7 +20,7 @@ These built-in sources are available from @scala[`org.apache.pekko.stream.scalad
2020
|Source|<a name="fromiterator"></a>@ref[fromIterator](Source/fromIterator.md)|Stream the values from an `Iterator`, requesting the next value when there is demand.|
2121
|Source|<a name="fromjavastream"></a>@ref[fromJavaStream](Source/fromJavaStream.md)|Stream the values from a Java 8 `Stream`, requesting the next value when there is demand.|
2222
|Source|<a name="fromoption"></a>@ref[fromOption](Source/fromOption.md)|Create a `Source` from an @scala[`Option[T]`] @java[`Optional<T>`] value, emitting the value if it is present.|
23-
|Source|<a name="frompublisher"></a>@ref[fromPublisher](Source/fromPublisher.md)|Integration with Reactive Streams, subscribes to a @javadoc[Publisher](java.util.concurrent.Flow.Publisher).|
23+
|Source|<a name="frompublisher"></a>@ref[fromPublisher](Source/fromPublisher.md)|Integration with Reactive Streams, subscribes to a `org.reactivestreams.Publisher`.|
2424
|Source|<a name="future"></a>@ref[future](Source/future.md)|Send the single value of the `Future` when it completes and there is demand.|
2525
|Source|<a name="futuresource"></a>@ref[futureSource](Source/futureSource.md)|Streams the elements of the given future source once it successfully completes.|
2626
|Source|<a name="iterate"></a>@ref[iterate](Source/iterate.md)|Creates a sequential `Source` by iterating with the given predicate, function and seed.|

0 commit comments

Comments
 (0)