나는 Future[Iterator]
입니다. 이 반복자를 내 스트림에 공급하고 싶습니다. 여기서, 나는 여전히 Source.fromIterator
을 사용하는 것과 같이 Iterator에서 Source를 생성하려고합니다.Future [Iterator]에서 소스를 만드는 방법은 무엇입니까?
하지만 여기서는 미래로 인해 Source.fromIterator
을 사용할 수 없습니다.
아마 내가 Source.fromFuture
을 사용할 수는 있지만 사용하려고 할 때 실제로는 내 케이스의 Iterator에서 Source를 만드는 것처럼 보이지 않습니다. 워드 프로세서에서 :
/**
* Starts a new `Source` from the given `Future`. The stream will consist of
* one element when the `Future` is completed with a successful value, which
* may happen before or after materializing the `Flow`.
* The stream terminates with a failure if the `Future` is completed with a failure.
*/
def fromFuture[T](future: Future[T]): Source[T, NotUsed] =
fromGraph(new FutureSource(future))
더하기, 우수한 팁. 이 방법에 대해 몰랐습니다. – oblivion