Akka Streams&断点续传。版本1.0-RC4中的外部Http请求

时间:2015-08-15 01:47:10

标签: akka akka-stream akka-http

在尝试创建http客户端/流程时,此代码似乎不再起作用了:

lazy val myConnectionFlow = 
 Http().outgoingConnection("localhost", port).flow

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

似乎flow方法不再可用。它确实被弃用了吗?以下是创建Http Connections的首选方法吗?

 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 :(得分:0)

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