Untangle settings from attributes in materializer #24063

Instead of renaming - deprecating and documenting

Renaming defaultInitialAttributes to defaultAttributes and adding docs

Tests passing

More work on using attributes for the attribute settings in ActorMaterializerSettings

Mark some attributes as mandatory and provide a smoother access w/o allocation for those

Another warning notice

MiMa filters

Part of the review adressed

Incorrect rebase fixed + formatting

Review feedback adressed

Formatting ...
This commit is contained in:
Johan Andrén 2017-11-22 13:51:24 +01:00 committed by Konrad `ktoso` Malawski
parent 4402c73a53
commit 4dde0742d0
20 changed files with 369 additions and 249 deletions

View file

@ -113,7 +113,7 @@ import scala.collection.generic.CanBuildFrom
val actorMaterializer = ActorMaterializerHelper.downcast(context.materializer)
val impl = actorMaterializer.actorOf(
context,
FanoutProcessorImpl.props(actorMaterializer.effectiveSettings(context.effectiveAttributes)))
FanoutProcessorImpl.props(context.effectiveAttributes, actorMaterializer.settings))
val fanoutProcessor = new ActorProcessor[In, In](impl)
impl ! ExposedPublisher(fanoutProcessor.asInstanceOf[ActorPublisher[Any]])
// Resolve cyclic dependency with actor. This MUST be the first message no matter what.
@ -174,10 +174,10 @@ import scala.collection.generic.CanBuildFrom
override def create(context: MaterializationContext) = {
val actorMaterializer = ActorMaterializerHelper.downcast(context.materializer)
val effectiveSettings = actorMaterializer.effectiveSettings(context.effectiveAttributes)
val maxInputBufferSize = context.effectiveAttributes.mandatoryAttribute[Attributes.InputBuffer].max
val subscriberRef = actorMaterializer.actorOf(
context,
ActorRefSinkActor.props(ref, effectiveSettings.maxInputBufferSize, onCompleteMessage))
ActorRefSinkActor.props(ref, maxInputBufferSize, onCompleteMessage))
(akka.stream.actor.ActorSubscriber[In](subscriberRef), NotUsed)
}
@ -469,7 +469,7 @@ import scala.collection.generic.CanBuildFrom
override def toString: String = "LazySink"
override def createLogicAndMaterializedValue(inheritedAttributes: Attributes) = {
lazy val decider = inheritedAttributes.get[SupervisionStrategy].map(_.decider).getOrElse(stoppingDecider)
lazy val decider = inheritedAttributes.mandatoryAttribute[SupervisionStrategy].decider
var completed = false
val promise = Promise[M]()