Make flowspec great again drewhk (#22443)

* #22435: Make DirectProcessorModule work again

* #22435: Fix attributes propagation for FanoutProcessor

* #22435: Remove old "faulty-flow" spec
This commit is contained in:
drewhk 2017-03-03 10:49:34 +01:00 committed by GitHub
parent 46b869d041
commit b33339f13e
5 changed files with 30 additions and 107 deletions

View file

@ -14,7 +14,7 @@ import akka.stream.impl.fusing.ActorGraphInterpreter.{ ActorOutputBoundary, Batc
import akka.stream.impl.fusing.GraphInterpreter.Connection
import akka.stream.impl.fusing._
import akka.stream.stage.{ GraphStageLogic, InHandler, OutHandler }
import org.reactivestreams.{ Publisher, Subscriber, Subscription }
import org.reactivestreams.{ Processor, Publisher, Subscriber, Subscription }
import scala.collection.immutable.Map
import scala.concurrent.duration.FiniteDuration
@ -39,6 +39,10 @@ object PhasedFusingActorMaterializer {
override def apply(settings: ActorMaterializerSettings, materializer: PhasedFusingActorMaterializer): PhaseIsland[Any] =
new SourceModulePhase(materializer).asInstanceOf[PhaseIsland[Any]]
},
ProcessorModuleIslandTag new Phase[Any] {
override def apply(settings: ActorMaterializerSettings, materializer: PhasedFusingActorMaterializer): PhaseIsland[Any] =
new ProcessorModulePhase(materializer).asInstanceOf[PhaseIsland[Any]]
},
GraphStageTag DefaultPhase
)
@ -699,3 +703,24 @@ final class SinkModulePhase(materializer: PhasedFusingActorMaterializer) extends
override def onIslandReady(): Unit = ()
}
object ProcessorModuleIslandTag extends IslandTag
final class ProcessorModulePhase(materializer: PhasedFusingActorMaterializer) extends PhaseIsland[Processor[Any, Any]] {
override def name: String = "ProcessorModulePhase"
private[this] var processor: Processor[Any, Any] = _
override def materializeAtomic(mod: AtomicModule[Shape, Any], attributes: Attributes): (Processor[Any, Any], Any) = {
val procAndMat = mod.asInstanceOf[ProcessorModule[Any, Any, Any]].createProcessor()
processor = procAndMat._1
procAndMat
}
override def assignPort(in: InPort, slot: Int, logic: Processor[Any, Any]): Unit = ()
override def assignPort(out: OutPort, slot: Int, logic: Processor[Any, Any]): Unit = ()
override def createPublisher(out: OutPort, logic: Processor[Any, Any]): Publisher[Any] = logic
override def takePublisher(slot: Int, publisher: Publisher[Any]): Unit = publisher.subscribe(processor)
override def onIslandReady(): Unit = ()
}