!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

@ -66,26 +66,25 @@ private[akka] class PublisherSink[In](val attributes: Attributes, shape: SinkSha
* INTERNAL API
*/
private[akka] final class FanoutPublisherSink[In](
initialBufferSize: Int,
maximumBufferSize: Int,
maxNumberOfSubscribers: Int,
val attributes: Attributes,
shape: SinkShape[In])
extends SinkModule[In, Publisher[In]](shape) {
override def create(context: MaterializationContext): (Subscriber[In], Publisher[In]) = {
val actorMaterializer = ActorMaterializer.downcast(context.materializer)
val fanoutActor = actorMaterializer.actorOf(context,
Props(new FanoutProcessorImpl(actorMaterializer.effectiveSettings(context.effectiveAttributes),
initialBufferSize, maximumBufferSize)).withDeploy(Deploy.local))
val fanoutProcessor = ActorProcessorFactory[In, In](fanoutActor)
val fanoutProcessor = ActorProcessorFactory[In, In](
actorMaterializer.actorOf(
context,
FanoutProcessorImpl.props(actorMaterializer.effectiveSettings(attributes), maxNumberOfSubscribers)))
(fanoutProcessor, fanoutProcessor)
}
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Publisher[In]] =
new FanoutPublisherSink[In](initialBufferSize, maximumBufferSize, attributes, shape)
new FanoutPublisherSink[In](maxNumberOfSubscribers, attributes, shape)
override def withAttributes(attr: Attributes): Module =
new FanoutPublisherSink[In](initialBufferSize, maximumBufferSize, attr, amendShape(attr))
new FanoutPublisherSink[In](maxNumberOfSubscribers, attr, amendShape(attr))
}
/**