【发布时间】:2021-03-18 14:45:03
【问题描述】:
有一个有状态的流:
val stream = Flow[Event].statefulMapConcat {
() =>
val state = ...
{
element =>
// change the state
element :: Nil
}
}
它是流程的一部分
Flow[Event]
.groupBy(1000000, event => event.key2, allowClosedSubstreamRecreation = true)
.via(stream)
.mergeSubstreams
有没有办法让每个子流在stream 中有一个state(在这个例子中是groupBy 之后的每个键)?
我认为它应该按子流实现,但不知道该怎么做。
【问题讨论】:
标签: scala akka akka-stream