!str - Switches Sink.publisher to use a boolean to indicate fanout rather than a number of allowed subscribers

This commit is contained in:
Viktor Klang 2015-11-03 12:53:24 +01:00
parent f839a1f85d
commit 6cfa4df800
53 changed files with 221 additions and 212 deletions

View file

@ -287,6 +287,23 @@ should be replaced by
.. includecode:: code/docs/MigrationsJava.java#flatMapConcat
`Sink.fanoutPublisher() and Sink.publisher() is now a single method`
====================================================================
It was a common user mistake to use ``Sink.publisher`` and get into trouble since it would only support
a single ``Subscriber``, and the discoverability of the apprpriate fix was non-obvious (Sink.fanoutPublisher).
To make the decision whether to support fanout or not an active one, the aforementioned methods have been
replaced with a single method: ``Sink.publisher(fanout: Boolean)``.
Update procedure
----------------
1. Replace all occurences of ``Sink.publisher`` with ``Sink.publisher(false)``
2. Replace all occurences of ``Sink.fanoutPublisher`` with ``Sink.publisher(true)``
TODO: code example
FlexiMerge an FlexiRoute has been replaced by GraphStage
========================================================

View file

@ -107,8 +107,8 @@ This is how it can be used as input :class:`Source` to a :class:`Flow`:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/stream/ActorPublisherDocTest.java#actor-publisher-usage
You can only attach one subscriber to this publisher. Increase the max number of subscribers parameter or use a `Broadcast` element
in order to support multiple subscribers.
You can only attach one subscriber to this publisher. Use a ``Broadcast``-element or
attach a ``Sink.publisher(true)`` to enable multiple subscribers.
ActorSubscriber
^^^^^^^^^^^^^^^
@ -414,10 +414,10 @@ by using the Publisher-:class:`Sink`:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/stream/ReactiveStreamsDocTest.java#source-publisher
A publisher that is created with ``Sink.publisher`` supports a specified number of subscribers. Additional
subscription attempts will be rejected with an :class:`IllegalStateException`.
A publisher that is created with ``Sink.publisher(false)`` supports only a single subscription.
Additional subscription attempts will be rejected with an :class:`IllegalStateException`.
A publisher that supports multiple subscribers is created as follows:
A publisher that supports multiple subscribers using fan-out/broadcasting is created as follows:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/stream/ReactiveStreamsDocTest.java
:include: author-alert-subscriber,author-storage-subscriber