Hi Simon,
you could also try to split up the asynchronous computation and the actual filtering like this:
def filterFunc(e: E): Future[Result]
xyz.mapAsync(n)(e => filterFunc(e).map(res => e -> res))
.via(statefulFilterGraphStage)
And then implement the `statefulFilterGraphStage` with whatever stateful logic you need. The advantage would be that you don't need to manage asynchronous future completion in the single stage.
Would that work?
Johannes