Akka 流和 Http。版本 1.0-RC4 中的外部 Http 请求

Akka Streams & Http. External Http Request in version 1.0-RC4

尝试创建 http client/flow:

时,此代码似乎不再有效
lazy val myConnectionFlow = 
 Http().outgoingConnection("localhost", port).flow

def myRequest(request: HttpRequest): Future[HttpResponse] = 
 Source.single(request).via(myConnectionFlow).runWith(Sink.head)

似乎 flow 方法不再可用。它真的被弃用了吗?下面是创建 Http 连接的首选方法吗?

 val connFlow: Flow[HttpRequest, HttpResponse, Future[Http.OutgoingConnection]] =
  Http().outgoingConnection("localhost", port)

 val responseFuture: Future[HttpResponse] =
  Source.single(HttpRequest(uri="XXX"))
  .via(connFlow).runWith(Sink.head)

是的。实验模块没有弃用期,特别是在达到 1.0 之前。