我已经使用 GraphDSL.create() 配置了一个 RunnableGraph。我还指定了一个 ClosedShape 并连接了所有出口/入口。当我尝试执行程序时,出现以下运行时异常:
requirement failed: The inlets [] and outlets [] must correspond to the inlets [filter.in] and outlets [out]
知道我没有正确连接入口和出口的地方吗?
这是图形代码:
val g = RunnableGraph.fromGraph(GraphDSL.create() {
implicit builder =>
import GraphDSL.Implicits._
// Source
val A: Outlet[String] = builder.add(Source.fromIterator(() => flightDelayLines)).out
// Flows
val B: FlowShape[String, FlightEvent] = builder.add(csvToFlightEvent)
val C: FlowShape[FlightEvent, DelayRecord] = builder.add(flightEventToDelayRecord)
val D: UniformFanOutShape[DelayRecord, DelayRecord] = builder.add(Broadcast[DelayRecord](2))
val F: FlowShape[DelayRecord, (Int, Int)] = builder.add(countByCarrier)
// Sinks
val E: Inlet[Any] = builder.add(Sink.ignore).in
val G: Inlet[Any] = builder.add(Sink.ignore).in
// Graph
A ~> B ~> flightEventToDelayRecord ~> D ~> E
D ~> F ~> G
ClosedShape
}).run()