!str - 18808 - Removes Sink.fanoutPublisher and makes Sink.publisher specify number of subscribers

Sink.publisher now takes a max number of Subscribers and
the elasticity between concurrent Subscribers.
This commit is contained in:
Viktor Klang 2015-10-30 16:00:44 +01:00
parent 33444c572b
commit f839a1f85d
54 changed files with 246 additions and 238 deletions

View file

@ -45,10 +45,14 @@ object Sink {
/**
* A `Sink` that materializes into a [[org.reactivestreams.Publisher]].
* that can handle one [[org.reactivestreams.Subscriber]].
* that can handle `maxNumberOfSubscribers` [[org.reactivestreams.Subscriber]]s.
*
* If `maxNumberOfSubscribers` is greater than 1, the size of the `inputBuffer` configured for this stage
* becomes the maximum number of elements that the fastest [[org.reactivestreams.Subscriber]] can be ahead
* of the slowest one before slowing the processing down due to back pressure.
*/
def publisher[In](): Sink[In, Publisher[In]] =
new Sink(scaladsl.Sink.publisher)
def publisher[In](maxNumberOfSubscribers: Int): Sink[In, Publisher[In]] =
new Sink(scaladsl.Sink.publisher(maxNumberOfSubscribers))
/**
* A `Sink` that will invoke the given procedure for each received element. The sink is materialized
@ -73,13 +77,6 @@ object Sink {
def foreachParallel[T](parallel: Int)(f: function.Procedure[T])(ec: ExecutionContext): Sink[T, Future[Unit]] =
new Sink(scaladsl.Sink.foreachParallel(parallel)(f.apply)(ec))
/**
* A `Sink` that materializes into a [[org.reactivestreams.Publisher]]
* that can handle more than one [[org.reactivestreams.Subscriber]].
*/
def fanoutPublisher[T](initialBufferSize: Int, maximumBufferSize: Int): Sink[T, Publisher[T]] =
new Sink(scaladsl.Sink.fanoutPublisher(initialBufferSize, maximumBufferSize))
/**
* A `Sink` that when the flow is completed, either through a failure or normal
* completion, apply the provided function with [[scala.util.Success]]